Bugzilla – Attachment 60106 Details for
Bug 137156
VUL-0: CVE-2005-3193: xpdf: overflows
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
updated patch for CAN-2005-3193
CAN-2005-3193-updated.patch (text/plain), 4.30 KB, created by
Dirk Mueller
on 2005-12-08 13:31:38 UTC
(
hide
)
Description:
updated patch for CAN-2005-3193
Filename:
MIME Type:
Creator:
Dirk Mueller
Created:
2005-12-08 13:31:38 UTC
Size:
4.30 KB
patch
obsolete
>Index: Stream.cc >=================================================================== >--- Stream.cc (revision 485850) >+++ Stream.cc (revision 486692) >@@ -408,18 +408,33 @@ void ImageStream::skipLine() { > > StreamPredictor::StreamPredictor(Stream *strA, int predictorA, > int widthA, int nCompsA, int nBitsA) { >+ int totalBits; >+ > str = strA; > predictor = predictorA; > width = widthA; > nComps = nCompsA; > nBits = nBitsA; >+ predLine = NULL; >+ ok = gFalse; > > nVals = width * nComps; >+ totalBits = nVals * nBits; >+ if (totalBits == 0 || >+ (totalBits / nBits) / nComps != width || >+ totalBits + 7 < 0) { >+ return; >+ } > pixBytes = (nComps * nBits + 7) >> 3; >- rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes; >+ rowBytes = ((totalBits + 7) >> 3) + pixBytes; >+ if (rowBytes < 0) { >+ return; >+ } > predLine = (Guchar *)gmalloc(rowBytes); > memset(predLine, 0, rowBytes); > predIdx = rowBytes; >+ >+ ok = gTrue; > } > > StreamPredictor::~StreamPredictor() { >@@ -1013,6 +1028,10 @@ LZWStream::LZWStream(Stream *strA, int p > FilterStream(strA) { > if (predictor != 1) { > pred = new StreamPredictor(this, predictor, columns, colors, bits); >+ if (!pred->isOk()) { >+ delete pred; >+ pred = NULL; >+ } > } else { > pred = NULL; > } >@@ -2899,6 +2918,10 @@ GBool DCTStream::readBaselineSOF() { > height = read16(); > width = read16(); > numComps = str->getChar(); >+ if (numComps <= 0 || numComps > 4) { >+ error(getPos(), "Bad number of components in DCT stream"); >+ return gFalse; >+ } > if (prec != 8) { > error(getPos(), "Bad DCT precision %d", prec); > return gFalse; >@@ -2925,6 +2948,10 @@ GBool DCTStream::readProgressiveSOF() { > height = read16(); > width = read16(); > numComps = str->getChar(); >+ if (numComps <= 0 || numComps > 4) { >+ error(getPos(), "Bad number of components in DCT stream"); >+ return gFalse; >+ } > if (prec != 8) { > error(getPos(), "Bad DCT precision %d", prec); > return gFalse; >@@ -2947,6 +2974,10 @@ GBool DCTStream::readScanInfo() { > > length = read16() - 2; > scanInfo.numComps = str->getChar(); >+ if (scanInfo.numComps <= 0 || scanInfo.numComps > 4) { >+ error(getPos(), "Bad number of components in DCT stream"); >+ return gFalse; >+ } > --length; > if (length != 2 * scanInfo.numComps + 3) { > error(getPos(), "Bad DCT scan info block"); >@@ -3258,6 +3289,10 @@ FlateStream::FlateStream(Stream *strA, i > FilterStream(strA) { > if (predictor != 1) { > pred = new StreamPredictor(this, predictor, columns, colors, bits); >+ if (!pred->isOk()) { >+ delete pred; >+ pred = NULL; >+ } > } else { > pred = NULL; > } >Index: Stream.h >=================================================================== >--- Stream.h (revision 485850) >+++ Stream.h (revision 486692) >@@ -233,6 +233,8 @@ public: > > ~StreamPredictor(); > >+ GBool isOk() { return ok; } >+ > int lookChar(); > int getChar(); > >@@ -250,6 +252,7 @@ private: > int rowBytes; // bytes per line > Guchar *predLine; // line buffer > int predIdx; // current index in predLine >+ GBool ok; > }; > > //------------------------------------------------------------------------ >Index: JPXStream.cc >=================================================================== >--- JPXStream.cc (revision 485850) >+++ JPXStream.cc (revision 486692) >@@ -666,7 +666,7 @@ GBool JPXStream::readCodestream(Guint /* > int segType; > GBool haveSIZ, haveCOD, haveQCD, haveSOT; > Guint precinctSize, style; >- Guint segLen, capabilities, comp, i, j, r; >+ Guint segLen, capabilities, nTiles, comp, i, j, r; > > //----- main header > haveSIZ = haveCOD = haveQCD = haveSOT = gFalse; >@@ -701,8 +701,12 @@ GBool JPXStream::readCodestream(Guint /* > / img.xTileSize; > img.nYTiles = (img.ySize - img.yTileOffset + img.yTileSize - 1) > / img.yTileSize; >- img.tiles = (JPXTile *)gmalloc(img.nXTiles * img.nYTiles * >- sizeof(JPXTile)); >+ nTiles = img.nXTiles * img.nYTiles; >+ if (img.nXTiles == 0 || nTiles / img.nXTiles != img.nYTiles) { >+ error(getPos(), "Bad tile count in JPX SIZ marker segment"); >+ return gFalse; >+ } >+ img.tiles = (JPXTile *)gmallocn(nTiles, sizeof(JPXTile)); > for (i = 0; i < img.nXTiles * img.nYTiles; ++i) { > img.tiles[i].tileComps = (JPXTileComp *)gmalloc(img.nComps * > sizeof(JPXTileComp));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 137156
:
59932
|
59935
|
60106
|
60190
|
60194
|
60264
|
60265
|
60405
|
60994
|
60995
|
60998
|
62964