[poppler] Which check is better?

Albert Astals Cid aacid at kde.org
Sun Feb 5 11:37:24 PST 2006


I've been having a look to the final merges kpdf -> poppler and this is one of 
the few easy things left, which of these merges seem better to you?

JPXStream.cc about line 824

      img.nXTiles = (img.xSize - img.xTileOffset + img.xTileSize - 1)
	            / img.xTileSize;
      img.nYTiles = (img.ySize - img.yTileOffset + img.yTileSize - 1)
	            / img.yTileSize;
      nTiles = img.nXTiles * img.nYTiles;
      // check for overflow before allocating memory
      if (nTiles == 0 || nTiles / img.nXTiles != img.nYTiles) {
	error(getPos(), "Bad tile count in JPX SIZ marker segment");
	return gFalse;
      }


      img.nXTiles = (img.xSize - img.xTileOffset + img.xTileSize - 1)
	            / img.xTileSize;
      img.nYTiles = (img.ySize - img.yTileOffset + img.yTileSize - 1)
	            / img.yTileSize;
      nTiles = img.nXTiles * img.nYTiles;
      // check for overflow before allocating memory
      if (img.nXTiles <= 0 || img.nYTiles <= 0 || img.nXTiles >= INT_MAX / 
img.nYTiles) {
	error(getPos(), "Bad tile count in JPX SIZ marker segment");
	return gFalse;
      }


ONLY the if is different 

Any idea of which may be better?

Albert

		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com


More information about the poppler mailing list