project
stringclasses 633
values | commit_id
stringlengths 7
81
| target
int64 0
1
| func
stringlengths 5
484k
| cwe
stringclasses 131
values | big_vul_idx
float64 0
189k
⌀ | idx
int64 0
522k
| hash
stringlengths 34
39
| size
float64 1
24k
⌀ | message
stringlengths 0
11.5k
⌀ | dataset
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
RunLengthEncoder::RunLengthEncoder(Stream *strA):
FilterStream(strA) {
bufPtr = bufEnd = nextEnd = buf;
eof = gFalse;
}
|
CWE-119
| 3,911 | 13,782 |
33159651841881406794587979745142114816
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
Stream::Stream() {
ref = 1;
}
|
CWE-119
| 3,913 | 13,783 |
291931742590039628713641455605398972293
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
StreamPredictor::StreamPredictor(Stream *strA, int predictorA,
int widthA, int nCompsA, int nBitsA) {
str = strA;
predictor = predictorA;
width = widthA;
nComps = nCompsA;
nBits = nBitsA;
predLine = NULL;
ok = gFalse;
nVals = width * nComps;
pixBytes = (nComps * nBits + 7) >> 3;
rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes;
if (width <= 0 || nComps <= 0 || nBits <= 0 ||
nComps > gfxColorMaxComps ||
nBits > 16 ||
width >= INT_MAX / nComps || // check for overflow in nVals
nVals >= (INT_MAX - 7) / nBits) { // check for overflow in rowBytes
return;
}
predLine = (Guchar *)gmalloc(rowBytes);
memset(predLine, 0, rowBytes);
predIdx = rowBytes;
ok = gTrue;
}
|
CWE-119
| 3,914 | 13,784 |
300144471611213196459951459661892200193
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
Stream *Stream::addFilters(Object *dict) {
Object obj, obj2;
Object params, params2;
Stream *str;
int i;
str = this;
dict->dictLookup("Filter", &obj);
if (obj.isNull()) {
obj.free();
dict->dictLookup("F", &obj);
}
dict->dictLookup("DecodeParms", ¶ms);
if (params.isNull()) {
params.free();
dict->dictLookup("DP", ¶ms);
}
if (obj.isName()) {
str = makeFilter(obj.getName(), str, ¶ms);
} else if (obj.isArray()) {
for (i = 0; i < obj.arrayGetLength(); ++i) {
obj.arrayGet(i, &obj2);
if (params.isArray())
params.arrayGet(i, ¶ms2);
else
params2.initNull();
if (obj2.isName()) {
str = makeFilter(obj2.getName(), str, ¶ms2);
} else {
error(errSyntaxError, getPos(), "Bad filter name");
str = new EOFStream(str);
}
obj2.free();
params2.free();
}
} else if (!obj.isNull()) {
error(errSyntaxError, getPos(), "Bad 'Filter' attribute in stream");
}
obj.free();
params.free();
return str;
}
|
CWE-119
| 3,915 | 13,785 |
120596132681794794045289941516844862456
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
inline void CCITTFaxStream::addPixels(int a1, int blackPixels) {
if (a1 > codingLine[a0i]) {
if (a1 > columns) {
error(errSyntaxError, getPos(),
"CCITTFax row is wrong length ({0:d})", a1);
err = gTrue;
a1 = columns;
}
if ((a0i & 1) ^ blackPixels) {
++a0i;
}
codingLine[a0i] = a1;
}
}
|
CWE-119
| 3,916 | 13,786 |
269469805222827497401410996394257996065
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
inline void CCITTFaxStream::addPixelsNeg(int a1, int blackPixels) {
if (a1 > codingLine[a0i]) {
if (a1 > columns) {
error(errSyntaxError, getPos(),
"CCITTFax row is wrong length ({0:d})", a1);
err = gTrue;
a1 = columns;
}
if ((a0i & 1) ^ blackPixels) {
++a0i;
}
codingLine[a0i] = a1;
} else if (a1 < codingLine[a0i]) {
if (a1 < 0) {
error(errSyntaxError, getPos(), "Invalid CCITTFax code");
err = gTrue;
a1 = 0;
}
while (a0i > 0 && a1 <= codingLine[a0i - 1]) {
--a0i;
}
codingLine[a0i] = a1;
}
}
|
CWE-119
| 3,917 | 13,787 |
260443660214016174646720131143379916514
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void CCITTFaxStream::ccittReset(GBool unfiltered) {
if (unfiltered)
str->unfilteredReset();
else
str->reset();
row = 0;
nextLine2D = encoding < 0;
inputBits = 0;
a0i = 0;
outputBits = 0;
buf = EOF;
}
|
CWE-119
| 3,918 | 13,788 |
231690343517087784594593785810238337436
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void LZWStream::clearTable() {
nextCode = 258;
nextBits = 9;
seqIndex = seqLength = 0;
first = gTrue;
}
|
CWE-119
| 3,919 | 13,789 |
12459636439177851310201898725390728338
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void Stream::close() {
}
|
CWE-119
| 3,920 | 13,790 |
186892726811770897889670492918293035859
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void FileOutStream::close ()
{
}
|
CWE-119
| 3,921 | 13,791 |
323883079637717262996520843909979337042
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void FilterStream::close() {
str->close();
}
|
CWE-119
| 3,922 | 13,792 |
57598534026185143905837418382050433716
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void ImageStream::close() {
str->close();
}
|
CWE-119
| 3,923 | 13,793 |
187820843695476551147975605176832481617
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void FileStream::close() {
if (saved) {
#if HAVE_FSEEKO
fseeko(f, savePos, SEEK_SET);
#elif HAVE_FSEEK64
fseek64(f, savePos, SEEK_SET);
#else
fseek(f, savePos, SEEK_SET);
#endif
saved = gFalse;
}
}
|
CWE-119
| 3,924 | 13,794 |
329707248056233611989029672157502720831
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void CachedFileStream::close()
{
if (saved) {
cc->seek(savePos, SEEK_SET);
saved = gFalse;
}
}
|
CWE-119
| 3,925 | 13,795 |
119483171541152771496580296052754606589
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void MemStream::close() {
}
|
CWE-119
| 3,926 | 13,796 |
239833423193206221853632447109989846665
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void DCTStream::close() {
int i, j;
for (i = 0; i < 4; ++i) {
for (j = 0; j < 32; ++j) {
gfree(rowBuf[i][j]);
rowBuf[i][j] = NULL;
}
gfree(frameBuf[i]);
frameBuf[i] = NULL;
}
FilterStream::close();
}
|
CWE-119
| 3,927 | 13,797 |
131233708795345121470004117829332643608
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void DCTStream::dctReset(GBool unfiltered) {
if (unfiltered)
str->unfilteredReset();
else
str->reset();
progressive = interleaved = gFalse;
width = height = 0;
numComps = 0;
numQuantTables = 0;
numDCHuffTables = 0;
numACHuffTables = 0;
gotJFIFMarker = gFalse;
gotAdobeMarker = gFalse;
restartInterval = 0;
}
|
CWE-119
| 3,928 | 13,798 |
163774944144899034292628967319488003441
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void DCTStream::decodeImage() {
int dataIn[64];
Guchar dataOut[64];
Gushort *quantTable;
int pY, pCb, pCr, pR, pG, pB;
int x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, cc, i;
int h, v, horiz, vert, hSub, vSub;
int *p0, *p1, *p2;
for (y1 = 0; y1 < bufHeight; y1 += mcuHeight) {
for (x1 = 0; x1 < bufWidth; x1 += mcuWidth) {
for (cc = 0; cc < numComps; ++cc) {
quantTable = quantTables[compInfo[cc].quantTable];
h = compInfo[cc].hSample;
v = compInfo[cc].vSample;
horiz = mcuWidth / h;
vert = mcuHeight / v;
hSub = horiz / 8;
vSub = vert / 8;
for (y2 = 0; y2 < mcuHeight; y2 += vert) {
for (x2 = 0; x2 < mcuWidth; x2 += horiz) {
p1 = &frameBuf[cc][(y1+y2) * bufWidth + (x1+x2)];
for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) {
dataIn[i] = p1[0];
dataIn[i+1] = p1[1];
dataIn[i+2] = p1[2];
dataIn[i+3] = p1[3];
dataIn[i+4] = p1[4];
dataIn[i+5] = p1[5];
dataIn[i+6] = p1[6];
dataIn[i+7] = p1[7];
p1 += bufWidth * vSub;
}
transformDataUnit(quantTable, dataIn, dataOut);
p1 = &frameBuf[cc][(y1+y2) * bufWidth + (x1+x2)];
if (hSub == 1 && vSub == 1) {
for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) {
p1[0] = dataOut[i] & 0xff;
p1[1] = dataOut[i+1] & 0xff;
p1[2] = dataOut[i+2] & 0xff;
p1[3] = dataOut[i+3] & 0xff;
p1[4] = dataOut[i+4] & 0xff;
p1[5] = dataOut[i+5] & 0xff;
p1[6] = dataOut[i+6] & 0xff;
p1[7] = dataOut[i+7] & 0xff;
p1 += bufWidth;
}
} else if (hSub == 2 && vSub == 2) {
p2 = p1 + bufWidth;
for (y3 = 0, i = 0; y3 < 16; y3 += 2, i += 8) {
p1[0] = p1[1] = p2[0] = p2[1] = dataOut[i] & 0xff;
p1[2] = p1[3] = p2[2] = p2[3] = dataOut[i+1] & 0xff;
p1[4] = p1[5] = p2[4] = p2[5] = dataOut[i+2] & 0xff;
p1[6] = p1[7] = p2[6] = p2[7] = dataOut[i+3] & 0xff;
p1[8] = p1[9] = p2[8] = p2[9] = dataOut[i+4] & 0xff;
p1[10] = p1[11] = p2[10] = p2[11] = dataOut[i+5] & 0xff;
p1[12] = p1[13] = p2[12] = p2[13] = dataOut[i+6] & 0xff;
p1[14] = p1[15] = p2[14] = p2[15] = dataOut[i+7] & 0xff;
p1 += bufWidth * 2;
p2 += bufWidth * 2;
}
} else {
i = 0;
for (y3 = 0, y4 = 0; y3 < 8; ++y3, y4 += vSub) {
for (x3 = 0, x4 = 0; x3 < 8; ++x3, x4 += hSub) {
p2 = p1 + x4;
for (y5 = 0; y5 < vSub; ++y5) {
for (x5 = 0; x5 < hSub; ++x5) {
p2[x5] = dataOut[i] & 0xff;
}
p2 += bufWidth;
}
++i;
}
p1 += bufWidth * vSub;
}
}
}
}
}
if (colorXform) {
if (numComps == 3) {
for (y2 = 0; y2 < mcuHeight; ++y2) {
p0 = &frameBuf[0][(y1+y2) * bufWidth + x1];
p1 = &frameBuf[1][(y1+y2) * bufWidth + x1];
p2 = &frameBuf[2][(y1+y2) * bufWidth + x1];
for (x2 = 0; x2 < mcuWidth; ++x2) {
pY = *p0;
pCb = *p1 - 128;
pCr = *p2 - 128;
pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16;
*p0++ = dctClip[dctClipOffset + pR];
pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr +
32768) >> 16;
*p1++ = dctClip[dctClipOffset + pG];
pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16;
*p2++ = dctClip[dctClipOffset + pB];
}
}
} else if (numComps == 4) {
for (y2 = 0; y2 < mcuHeight; ++y2) {
p0 = &frameBuf[0][(y1+y2) * bufWidth + x1];
p1 = &frameBuf[1][(y1+y2) * bufWidth + x1];
p2 = &frameBuf[2][(y1+y2) * bufWidth + x1];
for (x2 = 0; x2 < mcuWidth; ++x2) {
pY = *p0;
pCb = *p1 - 128;
pCr = *p2 - 128;
pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16;
*p0++ = 255 - dctClip[dctClipOffset + pR];
pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr +
32768) >> 16;
*p1++ = 255 - dctClip[dctClipOffset + pG];
pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16;
*p2++ = 255 - dctClip[dctClipOffset + pB];
}
}
}
}
}
}
}
|
CWE-119
| 3,929 | 13,799 |
183407112859286156583377424348515487996
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool FileStream::fillBuf() {
int n;
bufPos += bufEnd - buf;
bufPtr = bufEnd = buf;
if (limited && bufPos >= start + length) {
return gFalse;
}
if (limited && bufPos + fileStreamBufSize > start + length) {
n = start + length - bufPos;
} else {
n = fileStreamBufSize;
}
n = fread(buf, 1, n, f);
bufEnd = buf + n;
if (bufPtr >= bufEnd) {
return gFalse;
}
return gTrue;
}
|
CWE-119
| 3,930 | 13,800 |
205352219747513928156998198805652574438
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool CachedFileStream::fillBuf()
{
int n;
bufPos += bufEnd - buf;
bufPtr = bufEnd = buf;
if (limited && bufPos >= start + length) {
return gFalse;
}
if (limited && bufPos + cachedStreamBufSize > start + length) {
n = start + length - bufPos;
} else {
n = cachedStreamBufSize - (bufPos % cachedStreamBufSize);
}
cc->read(buf, 1, n);
bufEnd = buf + n;
if (bufPtr >= bufEnd) {
return gFalse;
}
return gTrue;
}
|
CWE-119
| 3,931 | 13,801 |
104502042607777130501775375230551197666
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool RunLengthStream::fillBuf() {
int c;
int n, i;
if (eof)
return gFalse;
c = str->getChar();
if (c == 0x80 || c == EOF) {
eof = gTrue;
return gFalse;
}
if (c < 0x80) {
n = c + 1;
for (i = 0; i < n; ++i)
buf[i] = (char)str->getChar();
} else {
n = 0x101 - c;
c = str->getChar();
for (i = 0; i < n; ++i)
buf[i] = (char)c;
}
bufPtr = buf;
bufEnd = buf + n;
return gTrue;
}
|
CWE-119
| 3,932 | 13,802 |
44848941320258347004950663213336827827
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool ASCIIHexEncoder::fillBuf() {
static const char *hex = "0123456789abcdef";
int c;
if (eof) {
return gFalse;
}
bufPtr = bufEnd = buf;
if ((c = str->getChar()) == EOF) {
*bufEnd++ = '>';
eof = gTrue;
} else {
if (lineLen >= 64) {
*bufEnd++ = '\n';
lineLen = 0;
}
*bufEnd++ = hex[(c >> 4) & 0x0f];
*bufEnd++ = hex[c & 0x0f];
lineLen += 2;
}
return gTrue;
}
|
CWE-119
| 3,933 | 13,803 |
268364754119154678301109101306260917821
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool ASCII85Encoder::fillBuf() {
Guint t;
char buf1[5];
int c0, c1, c2, c3;
int n, i;
if (eof) {
return gFalse;
}
c0 = str->getChar();
c1 = str->getChar();
c2 = str->getChar();
c3 = str->getChar();
bufPtr = bufEnd = buf;
if (c3 == EOF) {
if (c0 == EOF) {
n = 0;
t = 0;
} else {
if (c1 == EOF) {
n = 1;
t = c0 << 24;
} else if (c2 == EOF) {
n = 2;
t = (c0 << 24) | (c1 << 16);
} else {
n = 3;
t = (c0 << 24) | (c1 << 16) | (c2 << 8);
}
for (i = 4; i >= 0; --i) {
buf1[i] = (char)(t % 85 + 0x21);
t /= 85;
}
for (i = 0; i <= n; ++i) {
*bufEnd++ = buf1[i];
if (++lineLen == 65) {
*bufEnd++ = '\n';
lineLen = 0;
}
}
}
*bufEnd++ = '~';
*bufEnd++ = '>';
eof = gTrue;
} else {
t = (c0 << 24) | (c1 << 16) | (c2 << 8) | c3;
if (t == 0) {
*bufEnd++ = 'z';
if (++lineLen == 65) {
*bufEnd++ = '\n';
lineLen = 0;
}
} else {
for (i = 4; i >= 0; --i) {
buf1[i] = (char)(t % 85 + 0x21);
t /= 85;
}
for (i = 0; i <= 4; ++i) {
*bufEnd++ = buf1[i];
if (++lineLen == 65) {
*bufEnd++ = '\n';
lineLen = 0;
}
}
}
}
return gTrue;
}
|
CWE-119
| 3,934 | 13,804 |
66797608773861534372385253194641896383
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool RunLengthEncoder::fillBuf() {
int c, c1, c2;
int n;
if (eof)
return gFalse;
if (nextEnd < bufEnd + 1) {
if ((c1 = str->getChar()) == EOF) {
eof = gTrue;
return gFalse;
}
} else {
c1 = bufEnd[0] & 0xff;
}
if (nextEnd < bufEnd + 2) {
if ((c2 = str->getChar()) == EOF) {
eof = gTrue;
buf[0] = 0;
buf[1] = c1;
bufPtr = buf;
bufEnd = &buf[2];
return gTrue;
}
} else {
c2 = bufEnd[1] & 0xff;
}
c = 0; // make gcc happy
if (c1 == c2) {
n = 2;
while (n < 128 && (c = str->getChar()) == c1)
++n;
buf[0] = (char)(257 - n);
buf[1] = c1;
bufEnd = &buf[2];
if (c == EOF) {
eof = gTrue;
} else if (n < 128) {
buf[2] = c;
nextEnd = &buf[3];
} else {
nextEnd = bufEnd;
}
} else {
buf[1] = c1;
buf[2] = c2;
n = 2;
while (n < 128) {
if ((c = str->getChar()) == EOF) {
eof = gTrue;
break;
}
++n;
buf[n] = c;
if (buf[n] == buf[n-1])
break;
}
if (buf[n] == buf[n-1]) {
buf[0] = (char)(n-2-1);
bufEnd = &buf[n-1];
nextEnd = &buf[n+1];
} else {
buf[0] = (char)(n-1);
bufEnd = nextEnd = &buf[n+1];
}
}
bufPtr = buf;
return gTrue;
}
|
CWE-119
| 3,935 | 13,805 |
4073994309023033239400637658820279926
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool CMYKGrayEncoder::fillBuf() {
int c0, c1, c2, c3;
int i;
if (eof) {
return gFalse;
}
c0 = str->getChar();
c1 = str->getChar();
c2 = str->getChar();
c3 = str->getChar();
if (c3 == EOF) {
eof = gTrue;
return gFalse;
}
i = (3 * c0 + 6 * c1 + c2) / 10 + c3;
if (i > 255) i = 255;
bufPtr = bufEnd = buf;
*bufEnd++ = (char) i;
return gTrue;
}
|
CWE-119
| 3,936 | 13,806 |
149047281605125177124304655607279704453
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool RGBGrayEncoder::fillBuf() {
int c0, c1, c2;
int i;
if (eof) {
return gFalse;
}
c0 = str->getChar();
c1 = str->getChar();
c2 = str->getChar();
if (c2 == EOF) {
eof = gTrue;
return gFalse;
}
i = 255 - (3 * c0 + 6 * c1 + c2) / 10;
if (i < 0) i = 0;
bufPtr = bufEnd = buf;
*bufEnd++ = (char) i;
return gTrue;
}
|
CWE-119
| 3,937 | 13,807 |
317104053601437663958596451637460304370
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void FlateStream::flateReset(GBool unfiltered) {
if (unfiltered)
str->unfilteredReset();
else
str->reset();
index = 0;
remain = 0;
codeBuf = 0;
codeSize = 0;
compressedBlock = gFalse;
endOfBlock = gTrue;
eof = gTrue;
}
|
CWE-119
| 3,938 | 13,808 |
215259215952031944799869960851763745310
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
short CCITTFaxStream::getBlackCode() {
short code;
const CCITTCode *p;
int n;
code = 0; // make gcc happy
if (endOfBlock) {
code = lookBits(13);
if (code == EOF) {
return 1;
}
if ((code >> 7) == 0) {
p = &blackTab1[code];
} else if ((code >> 9) == 0 && (code >> 7) != 0) {
p = &blackTab2[(code >> 1) - 64];
} else {
p = &blackTab3[code >> 7];
}
if (p->bits > 0) {
eatBits(p->bits);
return p->n;
}
} else {
for (n = 2; n <= 6; ++n) {
code = lookBits(n);
if (code == EOF) {
return 1;
}
if (n < 6) {
code <<= 6 - n;
}
p = &blackTab3[code];
if (p->bits == n) {
eatBits(n);
return p->n;
}
}
for (n = 7; n <= 12; ++n) {
code = lookBits(n);
if (code == EOF) {
return 1;
}
if (n < 12) {
code <<= 12 - n;
}
if (code >= 64) {
p = &blackTab2[code - 64];
if (p->bits == n) {
eatBits(n);
return p->n;
}
}
}
for (n = 10; n <= 13; ++n) {
code = lookBits(n);
if (code == EOF) {
return 1;
}
if (n < 13) {
code <<= 13 - n;
}
p = &blackTab1[code];
if (p->bits == n) {
eatBits(n);
return p->n;
}
}
}
error(errSyntaxError, getPos(),
"Bad black code ({0:04x}) in CCITTFax stream", code);
eatBits(1);
return 1;
}
|
CWE-119
| 3,939 | 13,809 |
250619818454300858867154220532997123080
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int EmbedStream::getChar() {
if (limited && !length) {
return EOF;
}
--length;
return str->getChar();
}
|
CWE-119
| 3,941 | 13,810 |
50758543612578149254752041879692236689
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int LZWStream::getChar() {
if (pred) {
return pred->getChar();
}
if (eof) {
return EOF;
}
if (seqIndex >= seqLength) {
if (!processNextCode()) {
return EOF;
}
}
return seqBuf[seqIndex++];
}
|
CWE-119
| 3,942 | 13,811 |
109574741205089261188507018663567152654
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int DCTStream::getChar() {
int c;
if (y >= height) {
return EOF;
}
if (progressive || !interleaved) {
c = frameBuf[comp][y * bufWidth + x];
if (++comp == numComps) {
comp = 0;
if (++x == width) {
x = 0;
++y;
}
}
} else {
if (dy >= mcuHeight) {
if (!readMCURow()) {
y = height;
return EOF;
}
comp = 0;
x = 0;
dy = 0;
}
c = rowBuf[comp][dy][x];
if (++comp == numComps) {
comp = 0;
if (++x == width) {
x = 0;
++y;
++dy;
if (y == height) {
readTrailer();
}
}
}
}
return c;
}
|
CWE-119
| 3,943 | 13,812 |
134857004864192526979437820819717107136
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int FlateStream::getChar() {
if (pred) {
return pred->getChar();
}
return doGetRawChar();
}
|
CWE-119
| 3,944 | 13,813 |
322298633709487799629293895996772909676
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int BufStream::getChar() {
int c, i;
c = buf[0];
for (i = 1; i < bufSize; ++i) {
buf[i-1] = buf[i];
}
buf[bufSize - 1] = str->getChar();
return c;
}
|
CWE-119
| 3,945 | 13,814 |
262293107751639707020064879409238360987
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int FixedLengthEncoder::getChar() {
if (length >= 0 && count >= length)
return EOF;
++count;
return str->getChar();
}
|
CWE-119
| 3,946 | 13,815 |
335648495303531866809269504632542915684
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int StreamPredictor::getChars(int nChars, Guchar *buffer) {
int n, m;
n = 0;
while (n < nChars) {
if (predIdx >= rowBytes) {
if (!getNextLine()) {
break;
}
}
m = rowBytes - predIdx;
if (m > nChars - n) {
m = nChars - n;
}
memcpy(buffer + n, predLine + predIdx, m);
predIdx += m;
n += m;
}
return n;
}
|
CWE-119
| 3,947 | 13,816 |
246316328987477952866269713525263000685
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int MemStream::getChars(int nChars, Guchar *buffer) {
int n;
if (nChars <= 0) {
return 0;
}
if (bufEnd - bufPtr < nChars) {
n = (int)(bufEnd - bufPtr);
} else {
n = nChars;
}
memcpy(buffer, bufPtr, n);
bufPtr += n;
return n;
}
|
CWE-119
| 3,948 | 13,817 |
299909281471532101868587028793058766090
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int EmbedStream::getChars(int nChars, Guchar *buffer) {
if (nChars <= 0) {
return 0;
}
if (limited && length < (Guint)nChars) {
nChars = (int)length;
}
return str->doGetChars(nChars, buffer);
}
|
CWE-119
| 3,949 | 13,818 |
23930274673487448737129937298665426759
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int LZWStream::getChars(int nChars, Guchar *buffer) {
int n, m;
if (pred) {
return pred->getChars(nChars, buffer);
}
if (eof) {
return 0;
}
n = 0;
while (n < nChars) {
if (seqIndex >= seqLength) {
if (!processNextCode()) {
break;
}
}
m = seqLength - seqIndex;
if (m > nChars - n) {
m = nChars - n;
}
memcpy(buffer + n, seqBuf + seqIndex, m);
seqIndex += m;
n += m;
}
return n;
}
|
CWE-119
| 3,950 | 13,819 |
9692947685859349408350629028965028232
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int RunLengthStream::getChars(int nChars, Guchar *buffer) {
int n, m;
n = 0;
while (n < nChars) {
if (bufPtr >= bufEnd) {
if (!fillBuf()) {
break;
}
}
m = (int)(bufEnd - bufPtr);
if (m > nChars - n) {
m = nChars - n;
}
memcpy(buffer + n, bufPtr, m);
bufPtr += m;
n += m;
}
return n;
}
|
CWE-119
| 3,951 | 13,820 |
210119193830947029754725364918096395252
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int FlateStream::getChars(int nChars, Guchar *buffer) {
if (pred) {
return pred->getChars(nChars, buffer);
} else {
for (int i = 0; i < nChars; ++i) {
const int c = doGetRawChar();
if (likely(c != EOF)) buffer[i] = c;
else return i;
}
return nChars;
}
}
|
CWE-119
| 3,952 | 13,821 |
8276647139053428718050168922910299936
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int LZWStream::getCode() {
int c;
int code;
while (inputBits < nextBits) {
if ((c = str->getChar()) == EOF)
return EOF;
inputBuf = (inputBuf << 8) | (c & 0xff);
inputBits += 8;
}
code = (inputBuf >> (inputBits - nextBits)) & ((1 << nextBits) - 1);
inputBits -= nextBits;
return code;
}
|
CWE-119
| 3,953 | 13,822 |
156148486310078744059905868574273751308
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int FlateStream::getHuffmanCodeWord(FlateHuffmanTab *tab) {
FlateCode *code;
int c;
while (codeSize < tab->maxLen) {
if ((c = str->getChar()) == EOF) {
break;
}
codeBuf |= (c & 0xff) << codeSize;
codeSize += 8;
}
code = &tab->codes[codeBuf & ((1 << tab->maxLen) - 1)];
if (codeSize == 0 || codeSize < code->len || code->len == 0) {
return EOF;
}
codeBuf >>= code->len;
codeSize -= code->len;
return (int)code->val;
}
|
CWE-119
| 3,955 | 13,823 |
244307427806205043179801022761854832445
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
Guchar *ImageStream::getLine() {
Gulong buf, bitMask;
int bits;
int c;
int i;
Guchar *p;
int readChars = str->doGetChars(inputLineSize, inputLine);
for ( ; readChars < inputLineSize; readChars++) inputLine[readChars] = EOF;
if (nBits == 1) {
p = inputLine;
for (i = 0; i < nVals; i += 8) {
c = *p++;
imgLine[i+0] = (Guchar)((c >> 7) & 1);
imgLine[i+1] = (Guchar)((c >> 6) & 1);
imgLine[i+2] = (Guchar)((c >> 5) & 1);
imgLine[i+3] = (Guchar)((c >> 4) & 1);
imgLine[i+4] = (Guchar)((c >> 3) & 1);
imgLine[i+5] = (Guchar)((c >> 2) & 1);
imgLine[i+6] = (Guchar)((c >> 1) & 1);
imgLine[i+7] = (Guchar)(c & 1);
}
} else if (nBits == 8) {
} else if (nBits == 16) {
p = inputLine;
for (i = 0; i < nVals; ++i) {
imgLine[i] = *p++;
p++;
}
} else {
bitMask = (1 << nBits) - 1;
buf = 0;
bits = 0;
p = inputLine;
for (i = 0; i < nVals; ++i) {
if (bits < nBits) {
buf = (buf << 8) | (*p++ & 0xff);
bits += 8;
}
imgLine[i] = (Guchar)((buf >> (bits - nBits)) & bitMask);
bits -= nBits;
}
}
return imgLine;
}
|
CWE-119
| 3,957 | 13,824 |
231499299098679754425119219137645534752
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool StreamPredictor::getNextLine() {
int curPred;
Guchar upLeftBuf[gfxColorMaxComps * 2 + 1];
int left, up, upLeft, p, pa, pb, pc;
int c;
Gulong inBuf, outBuf, bitMask;
int inBits, outBits;
int i, j, k, kk;
if (predictor >= 10) {
if ((curPred = str->getRawChar()) == EOF) {
return gFalse;
}
curPred += 10;
} else {
curPred = predictor;
}
int *rawCharLine = new int[rowBytes - pixBytes];
str->getRawChars(rowBytes - pixBytes, rawCharLine);
memset(upLeftBuf, 0, pixBytes + 1);
for (i = pixBytes; i < rowBytes; ++i) {
for (j = pixBytes; j > 0; --j) {
upLeftBuf[j] = upLeftBuf[j-1];
}
upLeftBuf[0] = predLine[i];
if ((c = rawCharLine[i - pixBytes]) == EOF) {
if (i > pixBytes) {
break;
}
delete[] rawCharLine;
return gFalse;
}
switch (curPred) {
case 11: // PNG sub
predLine[i] = predLine[i - pixBytes] + (Guchar)c;
break;
case 12: // PNG up
predLine[i] = predLine[i] + (Guchar)c;
break;
case 13: // PNG average
predLine[i] = ((predLine[i - pixBytes] + predLine[i]) >> 1) +
(Guchar)c;
break;
case 14: // PNG Paeth
left = predLine[i - pixBytes];
up = predLine[i];
upLeft = upLeftBuf[pixBytes];
p = left + up - upLeft;
if ((pa = p - left) < 0)
pa = -pa;
if ((pb = p - up) < 0)
pb = -pb;
if ((pc = p - upLeft) < 0)
pc = -pc;
if (pa <= pb && pa <= pc)
predLine[i] = left + (Guchar)c;
else if (pb <= pc)
predLine[i] = up + (Guchar)c;
else
predLine[i] = upLeft + (Guchar)c;
break;
case 10: // PNG none
default: // no predictor or TIFF predictor
predLine[i] = (Guchar)c;
break;
}
}
delete[] rawCharLine;
if (predictor == 2) {
if (nBits == 1) {
inBuf = predLine[pixBytes - 1];
for (i = pixBytes; i < rowBytes; i += 8) {
inBuf = (inBuf << 8) | predLine[i];
predLine[i] ^= inBuf >> nComps;
}
} else if (nBits == 8) {
for (i = pixBytes; i < rowBytes; ++i) {
predLine[i] += predLine[i - nComps];
}
} else {
memset(upLeftBuf, 0, nComps + 1);
bitMask = (1 << nBits) - 1;
inBuf = outBuf = 0;
inBits = outBits = 0;
j = k = pixBytes;
for (i = 0; i < width; ++i) {
for (kk = 0; kk < nComps; ++kk) {
if (inBits < nBits) {
inBuf = (inBuf << 8) | (predLine[j++] & 0xff);
inBits += 8;
}
upLeftBuf[kk] = (Guchar)((upLeftBuf[kk] +
(inBuf >> (inBits - nBits))) & bitMask);
inBits -= nBits;
outBuf = (outBuf << nBits) | upLeftBuf[kk];
outBits += nBits;
if (outBits >= 8) {
predLine[k++] = (Guchar)(outBuf >> (outBits - 8));
outBits -= 8;
}
}
}
if (outBits > 0) {
predLine[k++] = (Guchar)((outBuf << (8 - outBits)) +
(inBuf & ((1 << (8 - outBits)) - 1)));
}
}
}
predIdx = pixBytes;
return gTrue;
}
|
CWE-119
| 3,958 | 13,825 |
108982510620181488821814254269936144693
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GooString *Stream::getPSFilter(int psLevel, const char *indent) {
return new GooString();
}
|
CWE-119
| 3,959 | 13,826 |
257444198534255351561212049970191262614
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GooString *ASCII85Stream::getPSFilter(int psLevel, const char *indent) {
GooString *s;
if (psLevel < 2) {
return NULL;
}
if (!(s = str->getPSFilter(psLevel, indent))) {
return NULL;
}
s->append(indent)->append("/ASCII85Decode filter\n");
return s;
}
|
CWE-119
| 3,961 | 13,827 |
76495513431284833689776411584234363744
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GooString *LZWStream::getPSFilter(int psLevel, const char *indent) {
GooString *s;
if (psLevel < 2 || pred) {
return NULL;
}
if (!(s = str->getPSFilter(psLevel, indent))) {
return NULL;
}
s->append(indent)->append("<< ");
if (!early) {
s->append("/EarlyChange 0 ");
}
s->append(">> /LZWDecode filter\n");
return s;
}
|
CWE-119
| 3,962 | 13,828 |
1253992311023849107643191754964146200
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GooString *RunLengthStream::getPSFilter(int psLevel, const char *indent) {
GooString *s;
if (psLevel < 2) {
return NULL;
}
if (!(s = str->getPSFilter(psLevel, indent))) {
return NULL;
}
s->append(indent)->append("/RunLengthDecode filter\n");
return s;
}
|
CWE-119
| 3,963 | 13,829 |
187981301282147505507796237111677601149
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GooString *CCITTFaxStream::getPSFilter(int psLevel, const char *indent) {
GooString *s;
char s1[50];
if (psLevel < 2) {
return NULL;
}
if (!(s = str->getPSFilter(psLevel, indent))) {
return NULL;
}
s->append(indent)->append("<< ");
if (encoding != 0) {
sprintf(s1, "/K %d ", encoding);
s->append(s1);
}
if (endOfLine) {
s->append("/EndOfLine true ");
}
if (byteAlign) {
s->append("/EncodedByteAlign true ");
}
sprintf(s1, "/Columns %d ", columns);
s->append(s1);
if (rows != 0) {
sprintf(s1, "/Rows %d ", rows);
s->append(s1);
}
if (!endOfBlock) {
s->append("/EndOfBlock false ");
}
if (black) {
s->append("/BlackIs1 true ");
}
s->append(">> /CCITTFaxDecode filter\n");
return s;
}
|
CWE-119
| 3,964 | 13,830 |
80074847806773477777766521629675827543
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GooString *DCTStream::getPSFilter(int psLevel, const char *indent) {
GooString *s;
if (psLevel < 2) {
return NULL;
}
if (!(s = str->getPSFilter(psLevel, indent))) {
return NULL;
}
s->append(indent)->append("<< >> /DCTDecode filter\n");
return s;
}
|
CWE-119
| 3,965 | 13,831 |
44262825023951824813347503773659196148
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GooString *FlateStream::getPSFilter(int psLevel, const char *indent) {
GooString *s;
if (psLevel < 3 || pred) {
return NULL;
}
if (!(s = str->getPSFilter(psLevel, indent))) {
return NULL;
}
s->append(indent)->append("<< >> /FlateDecode filter\n");
return s;
}
|
CWE-119
| 3,966 | 13,832 |
155332582199190414549700651661706027117
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool ImageStream::getPixel(Guchar *pix) {
int i;
if (imgIdx >= nVals) {
if (!getLine()) {
return gFalse;
}
imgIdx = 0;
}
for (i = 0; i < nComps; ++i) {
pix[i] = imgLine[imgIdx++];
}
return gTrue;
}
|
CWE-119
| 3,967 | 13,833 |
160563878209712912126145686341282295572
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int FileOutStream::getPos ()
{
return ftell(f);
}
|
CWE-119
| 3,968 | 13,834 |
17951792873975263521845348396478940778
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int Stream::getRawChar() {
error(errInternal, -1, "Internal: called getRawChar() on non-predictor stream");
return EOF;
}
|
CWE-119
| 3,969 | 13,835 |
59551029179714438048906312821801793058
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int FlateStream::getRawChar() {
return doGetRawChar();
}
|
CWE-119
| 3,970 | 13,836 |
256961302986334347296059335011684857029
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void Stream::getRawChars(int nChars, int *buffer) {
error(errInternal, -1, "Internal: called getRawChars() on non-predictor stream");
}
|
CWE-119
| 3,971 | 13,837 |
161700521720620260953052344210027939430
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void FlateStream::getRawChars(int nChars, int *buffer) {
for (int i = 0; i < nChars; ++i)
buffer[i] = doGetRawChar();
}
|
CWE-119
| 3,973 | 13,838 |
16926255765332659299519721716843486050
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
Guint EmbedStream::getStart() {
error(errInternal, -1, "Internal: called getStart() on EmbedStream");
return 0;
}
|
CWE-119
| 3,974 | 13,839 |
124289821804639977762225604066595763277
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
short CCITTFaxStream::getWhiteCode() {
short code;
const CCITTCode *p;
int n;
code = 0; // make gcc happy
if (endOfBlock) {
code = lookBits(12);
if (code == EOF) {
return 1;
}
if ((code >> 5) == 0) {
p = &whiteTab1[code];
} else {
p = &whiteTab2[code >> 3];
}
if (p->bits > 0) {
eatBits(p->bits);
return p->n;
}
} else {
for (n = 1; n <= 9; ++n) {
code = lookBits(n);
if (code == EOF) {
return 1;
}
if (n < 9) {
code <<= 9 - n;
}
p = &whiteTab2[code];
if (p->bits == n) {
eatBits(n);
return p->n;
}
}
for (n = 11; n <= 12; ++n) {
code = lookBits(n);
if (code == EOF) {
return 1;
}
if (n < 12) {
code <<= 12 - n;
}
p = &whiteTab1[code];
if (p->bits == n) {
eatBits(n);
return p->n;
}
}
}
error(errSyntaxError, getPos(),
"Bad white code ({0:04x}) in CCITTFax stream", code);
eatBits(1);
return 1;
}
|
CWE-119
| 3,976 | 13,840 |
38607403689117556160441022064097507040
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool ASCII85Stream::isBinary(GBool last) {
return str->isBinary(gFalse);
}
|
CWE-119
| 3,978 | 13,841 |
183479294968081166266447857148116035138
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool LZWStream::isBinary(GBool last) {
return str->isBinary(gTrue);
}
|
CWE-119
| 3,979 | 13,842 |
221495929244413209504754518474173453397
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool RunLengthStream::isBinary(GBool last) {
return str->isBinary(gTrue);
}
|
CWE-119
| 3,980 | 13,843 |
165314183761292983467641929264383780030
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool DCTStream::isBinary(GBool last) {
return str->isBinary(gTrue);
}
|
CWE-119
| 3,982 | 13,844 |
335948195842011347028139142225273549743
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool FlateStream::isBinary(GBool last) {
return str->isBinary(gTrue);
}
|
CWE-119
| 3,983 | 13,845 |
161627737514900324045105460378480684032
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool BufStream::isBinary(GBool last) {
return str->isBinary(gTrue);
}
|
CWE-119
| 3,984 | 13,846 |
127375527661505908618292898024439323647
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool FixedLengthEncoder::isBinary(GBool last) {
return str->isBinary(gTrue);
}
|
CWE-119
| 3,985 | 13,847 |
324588078780653717999039867114559052369
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void FlateStream::loadFixedCodes() {
litCodeTab.codes = fixedLitCodeTab.codes;
litCodeTab.maxLen = fixedLitCodeTab.maxLen;
distCodeTab.codes = fixedDistCodeTab.codes;
distCodeTab.maxLen = fixedDistCodeTab.maxLen;
}
|
CWE-119
| 3,986 | 13,848 |
138341015858147408762155883324966420521
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
short CCITTFaxStream::lookBits(int n) {
int c;
while (inputBits < n) {
if ((c = str->getChar()) == EOF) {
if (inputBits == 0) {
return EOF;
}
return (inputBuf << (n - inputBits)) & (0xffffffff >> (32 - n));
}
inputBuf = (inputBuf << 8) + c;
inputBits += 8;
}
return (inputBuf >> (inputBits - n)) & (0xffffffff >> (32 - n));
}
|
CWE-119
| 3,987 | 13,849 |
22652113857330887239152704334215752387
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int StreamPredictor::lookChar() {
if (predIdx >= rowBytes) {
if (!getNextLine()) {
return EOF;
}
}
return predLine[predIdx];
}
|
CWE-119
| 3,988 | 13,850 |
337007357700626695192852363256042798737
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int ASCII85Stream::lookChar() {
int k;
Gulong t;
if (index >= n) {
if (eof)
return EOF;
index = 0;
do {
c[0] = str->getChar();
} while (Lexer::isSpace(c[0]));
if (c[0] == '~' || c[0] == EOF) {
eof = gTrue;
n = 0;
return EOF;
} else if (c[0] == 'z') {
b[0] = b[1] = b[2] = b[3] = 0;
n = 4;
} else {
for (k = 1; k < 5; ++k) {
do {
c[k] = str->getChar();
} while (Lexer::isSpace(c[k]));
if (c[k] == '~' || c[k] == EOF)
break;
}
n = k - 1;
if (k < 5 && (c[k] == '~' || c[k] == EOF)) {
for (++k; k < 5; ++k)
c[k] = 0x21 + 84;
eof = gTrue;
}
t = 0;
for (k = 0; k < 5; ++k)
t = t * 85 + (c[k] - 0x21);
for (k = 3; k >= 0; --k) {
b[k] = (int)(t & 0xff);
t >>= 8;
}
}
}
return b[index];
}
|
CWE-119
| 3,990 | 13,851 |
125116740682394060639059937814657613427
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int FlateStream::lookChar() {
int c;
if (pred) {
return pred->lookChar();
}
while (remain == 0) {
if (endOfBlock && eof)
return EOF;
readSome();
}
c = buf[index];
return c;
}
|
CWE-119
| 3,993 | 13,852 |
177838310700301564449807875474658705816
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int BufStream::lookChar() {
return buf[0];
}
|
CWE-119
| 3,994 | 13,853 |
151502188663038055712373864541678393345
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int BufStream::lookChar(int idx) {
return buf[idx];
}
|
CWE-119
| 3,995 | 13,854 |
234889842201378574016457047801953444874
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int FixedLengthEncoder::lookChar() {
if (length >= 0 && count >= length)
return EOF;
return str->getChar();
}
|
CWE-119
| 3,996 | 13,855 |
295844459967796497184078492862036407771
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
Stream *Stream::makeFilter(char *name, Stream *str, Object *params) {
int pred; // parameters
int colors;
int bits;
int early;
int encoding;
GBool endOfLine, byteAlign, endOfBlock, black;
int columns, rows;
int colorXform;
Object globals, obj;
if (!strcmp(name, "ASCIIHexDecode") || !strcmp(name, "AHx")) {
str = new ASCIIHexStream(str);
} else if (!strcmp(name, "ASCII85Decode") || !strcmp(name, "A85")) {
str = new ASCII85Stream(str);
} else if (!strcmp(name, "LZWDecode") || !strcmp(name, "LZW")) {
pred = 1;
columns = 1;
colors = 1;
bits = 8;
early = 1;
if (params->isDict()) {
params->dictLookup("Predictor", &obj);
if (obj.isInt())
pred = obj.getInt();
obj.free();
params->dictLookup("Columns", &obj);
if (obj.isInt())
columns = obj.getInt();
obj.free();
params->dictLookup("Colors", &obj);
if (obj.isInt())
colors = obj.getInt();
obj.free();
params->dictLookup("BitsPerComponent", &obj);
if (obj.isInt())
bits = obj.getInt();
obj.free();
params->dictLookup("EarlyChange", &obj);
if (obj.isInt())
early = obj.getInt();
obj.free();
}
str = new LZWStream(str, pred, columns, colors, bits, early);
} else if (!strcmp(name, "RunLengthDecode") || !strcmp(name, "RL")) {
str = new RunLengthStream(str);
} else if (!strcmp(name, "CCITTFaxDecode") || !strcmp(name, "CCF")) {
encoding = 0;
endOfLine = gFalse;
byteAlign = gFalse;
columns = 1728;
rows = 0;
endOfBlock = gTrue;
black = gFalse;
if (params->isDict()) {
params->dictLookup("K", &obj);
if (obj.isInt()) {
encoding = obj.getInt();
}
obj.free();
params->dictLookup("EndOfLine", &obj);
if (obj.isBool()) {
endOfLine = obj.getBool();
}
obj.free();
params->dictLookup("EncodedByteAlign", &obj);
if (obj.isBool()) {
byteAlign = obj.getBool();
}
obj.free();
params->dictLookup("Columns", &obj);
if (obj.isInt()) {
columns = obj.getInt();
}
obj.free();
params->dictLookup("Rows", &obj);
if (obj.isInt()) {
rows = obj.getInt();
}
obj.free();
params->dictLookup("EndOfBlock", &obj);
if (obj.isBool()) {
endOfBlock = obj.getBool();
}
obj.free();
params->dictLookup("BlackIs1", &obj);
if (obj.isBool()) {
black = obj.getBool();
}
obj.free();
}
str = new CCITTFaxStream(str, encoding, endOfLine, byteAlign,
columns, rows, endOfBlock, black);
} else if (!strcmp(name, "DCTDecode") || !strcmp(name, "DCT")) {
colorXform = -1;
if (params->isDict()) {
if (params->dictLookup("ColorTransform", &obj)->isInt()) {
colorXform = obj.getInt();
}
obj.free();
}
str = new DCTStream(str, colorXform);
} else if (!strcmp(name, "FlateDecode") || !strcmp(name, "Fl")) {
pred = 1;
columns = 1;
colors = 1;
bits = 8;
if (params->isDict()) {
params->dictLookup("Predictor", &obj);
if (obj.isInt())
pred = obj.getInt();
obj.free();
params->dictLookup("Columns", &obj);
if (obj.isInt())
columns = obj.getInt();
obj.free();
params->dictLookup("Colors", &obj);
if (obj.isInt())
colors = obj.getInt();
obj.free();
params->dictLookup("BitsPerComponent", &obj);
if (obj.isInt())
bits = obj.getInt();
obj.free();
}
str = new FlateStream(str, pred, columns, colors, bits);
} else if (!strcmp(name, "JBIG2Decode")) {
if (params->isDict()) {
params->dictLookup("JBIG2Globals", &globals);
}
str = new JBIG2Stream(str, &globals);
globals.free();
} else if (!strcmp(name, "JPXDecode")) {
str = new JPXStream(str);
} else {
error(errSyntaxError, getPos(), "Unknown filter '{0:s}'", name);
str = new EOFStream(str);
}
return str;
}
|
CWE-119
| 3,997 | 13,856 |
45009069073169373478547203454306441096
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
Stream *FileStream::makeSubStream(Guint startA, GBool limitedA,
Guint lengthA, Object *dictA) {
return new FileStream(f, startA, limitedA, lengthA, dictA);
}
|
CWE-119
| 3,998 | 13,857 |
197891167290864432374377081647920556357
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
Stream *CachedFileStream::makeSubStream(Guint startA, GBool limitedA,
Guint lengthA, Object *dictA)
{
cc->incRefCnt();
return new CachedFileStream(cc, startA, limitedA, lengthA, dictA);
}
|
CWE-119
| 3,999 | 13,858 |
125124973857767648573818207164395586822
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
Stream *MemStream::makeSubStream(Guint startA, GBool limited,
Guint lengthA, Object *dictA) {
MemStream *subStr;
Guint newLength;
if (!limited || startA + lengthA > start + length) {
newLength = start + length - startA;
} else {
newLength = lengthA;
}
subStr = new MemStream(buf, startA, newLength, dictA);
return subStr;
}
|
CWE-119
| 4,000 | 13,859 |
62998288899299745209449316678586253301
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
Stream *EmbedStream::makeSubStream(Guint start, GBool limitedA,
Guint lengthA, Object *dictA) {
error(errInternal, -1, "Called makeSubStream() on EmbedStream");
return NULL;
}
|
CWE-119
| 4,001 | 13,860 |
63366878330878415230677660679901428309
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void FileStream::moveStart(int delta) {
start += delta;
bufPtr = bufEnd = buf;
bufPos = start;
}
|
CWE-119
| 4,002 | 13,861 |
30379463303671668614243740444375611641
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void CachedFileStream::moveStart(int delta)
{
start += delta;
bufPtr = bufEnd = buf;
bufPos = start;
}
|
CWE-119
| 4,003 | 13,862 |
302764312075532539773627965338343725903
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void MemStream::moveStart(int delta) {
start += delta;
length -= delta;
bufPtr = buf + start;
}
|
CWE-119
| 4,004 | 13,863 |
215184759228476766333274213853308913416
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void EmbedStream::moveStart(int delta) {
error(errInternal, -1, "Internal: called moveStart() on EmbedStream");
}
|
CWE-119
| 4,005 | 13,864 |
205250703332210066493098528560501077048
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void FileOutStream::printf(const char *format, ...)
{
va_list argptr;
va_start (argptr, format);
vfprintf(f, format, argptr);
va_end (argptr);
}
|
CWE-119
| 4,006 | 13,865 |
99647609782749903906356697853305682816
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool LZWStream::processNextCode() {
int code;
int nextLength;
int i, j;
if (eof) {
return gFalse;
}
start:
code = getCode();
if (code == EOF || code == 257) {
eof = gTrue;
return gFalse;
}
if (code == 256) {
clearTable();
goto start;
}
if (nextCode >= 4097) {
error(errSyntaxError, getPos(),
"Bad LZW stream - expected clear-table code");
clearTable();
}
nextLength = seqLength + 1;
if (code < 256) {
seqBuf[0] = code;
seqLength = 1;
} else if (code < nextCode) {
seqLength = table[code].length;
for (i = seqLength - 1, j = code; i > 0; --i) {
seqBuf[i] = table[j].tail;
j = table[j].head;
}
seqBuf[0] = j;
} else if (code == nextCode) {
seqBuf[seqLength] = newChar;
++seqLength;
} else {
error(errSyntaxError, getPos(), "Bad LZW stream - unexpected code");
eof = gTrue;
return gFalse;
}
newChar = seqBuf[0];
if (first) {
first = gFalse;
} else {
table[nextCode].length = nextLength;
table[nextCode].head = prevCode;
table[nextCode].tail = newChar;
++nextCode;
if (nextCode + early == 512)
nextBits = 10;
else if (nextCode + early == 1024)
nextBits = 11;
else if (nextCode + early == 2048)
nextBits = 12;
}
prevCode = code;
seqIndex = 0;
return gTrue;
}
|
CWE-119
| 4,007 | 13,866 |
244783356823757572745380231125438495337
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int DCTStream::read16() {
int c1, c2;
if ((c1 = str->getChar()) == EOF)
return EOF;
if ((c2 = str->getChar()) == EOF)
return EOF;
return (c1 << 8) + c2;
}
|
CWE-119
| 4,009 | 13,867 |
59291732158783097954684336453991686964
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool DCTStream::readAdobeMarker() {
int length, i;
char buf[12];
int c;
length = read16();
if (length < 14) {
goto err;
}
for (i = 0; i < 12; ++i) {
if ((c = str->getChar()) == EOF) {
goto err;
}
buf[i] = c;
}
if (strncmp(buf, "Adobe", 5)) {
goto err;
}
colorXform = buf[11];
gotAdobeMarker = gTrue;
for (i = 14; i < length; ++i) {
if (str->getChar() == EOF) {
goto err;
}
}
return gTrue;
err:
error(errSyntaxError, getPos(), "Bad DCT Adobe APP14 marker");
return gFalse;
}
|
CWE-119
| 4,010 | 13,868 |
186550639161482430561855956201308079058
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int DCTStream::readAmp(int size) {
int amp, bit;
int bits;
amp = 0;
for (bits = 0; bits < size; ++bits) {
if ((bit = readBit()) == EOF)
return 9999;
amp = (amp << 1) + bit;
}
if (amp < (1 << (size - 1)))
amp -= (1 << size) - 1;
return amp;
}
|
CWE-119
| 4,011 | 13,869 |
111497074021905801389889840493748563708
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool DCTStream::readBaselineSOF() {
int length;
int prec;
int i;
int c;
length = read16();
prec = str->getChar();
height = read16();
width = read16();
numComps = str->getChar();
if (numComps <= 0 || numComps > 4) {
error(errSyntaxError, getPos(), "Bad number of components in DCT stream");
numComps = 0;
return gFalse;
}
if (prec != 8) {
error(errSyntaxError, getPos(), "Bad DCT precision {0:d}", prec);
return gFalse;
}
for (i = 0; i < numComps; ++i) {
compInfo[i].id = str->getChar();
c = str->getChar();
compInfo[i].hSample = (c >> 4) & 0x0f;
compInfo[i].vSample = c & 0x0f;
compInfo[i].quantTable = str->getChar();
if (compInfo[i].hSample < 1 || compInfo[i].hSample > 4 ||
compInfo[i].vSample < 1 || compInfo[i].vSample > 4) {
error(errSyntaxError, getPos(), "Bad DCT sampling factor");
return gFalse;
}
if (compInfo[i].quantTable < 0 || compInfo[i].quantTable > 3) {
error(errSyntaxError, getPos(), "Bad DCT quant table selector");
return gFalse;
}
}
progressive = gFalse;
return gTrue;
}
|
CWE-119
| 4,012 | 13,870 |
39717489081261519573774945631243286111
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int DCTStream::readBit() {
int bit;
int c, c2;
if (inputBits == 0) {
if ((c = str->getChar()) == EOF)
return EOF;
if (c == 0xff) {
do {
c2 = str->getChar();
} while (c2 == 0xff);
if (c2 != 0x00) {
error(errSyntaxError, getPos(), "Bad DCT data: missing 00 after ff");
return EOF;
}
}
inputBuf = c;
inputBits = 8;
}
bit = (inputBuf >> (inputBits - 1)) & 1;
--inputBits;
return bit;
}
|
CWE-119
| 4,013 | 13,871 |
128188133316809192900378709133581464415
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool FlateStream::readDynamicCodes() {
int numCodeLenCodes;
int numLitCodes;
int numDistCodes;
int codeLenCodeLengths[flateMaxCodeLenCodes];
FlateHuffmanTab codeLenCodeTab;
int len, repeat, code;
int i;
codeLenCodeTab.codes = NULL;
if ((numLitCodes = getCodeWord(5)) == EOF) {
goto err;
}
numLitCodes += 257;
if ((numDistCodes = getCodeWord(5)) == EOF) {
goto err;
}
numDistCodes += 1;
if ((numCodeLenCodes = getCodeWord(4)) == EOF) {
goto err;
}
numCodeLenCodes += 4;
if (numLitCodes > flateMaxLitCodes ||
numDistCodes > flateMaxDistCodes ||
numCodeLenCodes > flateMaxCodeLenCodes) {
goto err;
}
for (i = 0; i < flateMaxCodeLenCodes; ++i) {
codeLenCodeLengths[i] = 0;
}
for (i = 0; i < numCodeLenCodes; ++i) {
if ((codeLenCodeLengths[codeLenCodeMap[i]] = getCodeWord(3)) == -1) {
goto err;
}
}
compHuffmanCodes(codeLenCodeLengths, flateMaxCodeLenCodes, &codeLenCodeTab);
len = 0;
repeat = 0;
i = 0;
while (i < numLitCodes + numDistCodes) {
if ((code = getHuffmanCodeWord(&codeLenCodeTab)) == EOF) {
goto err;
}
if (code == 16) {
if ((repeat = getCodeWord(2)) == EOF) {
goto err;
}
repeat += 3;
if (i + repeat > numLitCodes + numDistCodes) {
goto err;
}
for (; repeat > 0; --repeat) {
codeLengths[i++] = len;
}
} else if (code == 17) {
if ((repeat = getCodeWord(3)) == EOF) {
goto err;
}
repeat += 3;
if (i + repeat > numLitCodes + numDistCodes) {
goto err;
}
len = 0;
for (; repeat > 0; --repeat) {
codeLengths[i++] = 0;
}
} else if (code == 18) {
if ((repeat = getCodeWord(7)) == EOF) {
goto err;
}
repeat += 11;
if (i + repeat > numLitCodes + numDistCodes) {
goto err;
}
len = 0;
for (; repeat > 0; --repeat) {
codeLengths[i++] = 0;
}
} else {
codeLengths[i++] = len = code;
}
}
compHuffmanCodes(codeLengths, numLitCodes, &litCodeTab);
compHuffmanCodes(codeLengths + numLitCodes, numDistCodes, &distCodeTab);
gfree(codeLenCodeTab.codes);
return gTrue;
err:
error(errSyntaxError, getPos(), "Bad dynamic code table in flate stream");
gfree(codeLenCodeTab.codes);
return gFalse;
}
|
CWE-119
| 4,015 | 13,872 |
195271112125936195009154061286829153191
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool DCTStream::readHuffmanTables() {
DCTHuffTable *tbl;
int length;
int index;
Gushort code;
Guchar sym;
int i;
int c;
length = read16() - 2;
while (length > 0) {
index = str->getChar();
--length;
if ((index & 0x0f) >= 4) {
error(errSyntaxError, getPos(), "Bad DCT Huffman table");
return gFalse;
}
if (index & 0x10) {
index &= 0x0f;
if (index >= numACHuffTables)
numACHuffTables = index+1;
tbl = &acHuffTables[index];
} else {
index &= 0x0f;
if (index >= numDCHuffTables)
numDCHuffTables = index+1;
tbl = &dcHuffTables[index];
}
sym = 0;
code = 0;
for (i = 1; i <= 16; ++i) {
c = str->getChar();
tbl->firstSym[i] = sym;
tbl->firstCode[i] = code;
tbl->numCodes[i] = c;
sym += c;
code = (code + c) << 1;
}
length -= 16;
for (i = 0; i < sym; ++i)
tbl->sym[i] = str->getChar();
length -= sym;
}
return gTrue;
}
|
CWE-119
| 4,018 | 13,873 |
268503579746817126815109899018314358110
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool DCTStream::readJFIFMarker() {
int length, i;
char buf[5];
int c;
length = read16();
length -= 2;
if (length >= 5) {
for (i = 0; i < 5; ++i) {
if ((c = str->getChar()) == EOF) {
error(errSyntaxError, getPos(), "Bad DCT APP0 marker");
return gFalse;
}
buf[i] = c;
}
length -= 5;
if (!memcmp(buf, "JFIF\0", 5)) {
gotJFIFMarker = gTrue;
}
}
while (length > 0) {
if (str->getChar() == EOF) {
error(errSyntaxError, getPos(), "Bad DCT APP0 marker");
return gFalse;
}
--length;
}
return gTrue;
}
|
CWE-119
| 4,019 | 13,874 |
46226669352919695949009643732341682792
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool DCTStream::readMCURow() {
int data1[64];
Guchar data2[64];
Guchar *p1, *p2;
int pY, pCb, pCr, pR, pG, pB;
int h, v, horiz, vert, hSub, vSub;
int x1, x2, y2, x3, y3, x4, y4, x5, y5, cc, i;
int c;
for (x1 = 0; x1 < width; x1 += mcuWidth) {
if (restartInterval > 0 && restartCtr == 0) {
c = readMarker();
if (c != restartMarker) {
error(errSyntaxError, getPos(),
"Bad DCT data: incorrect restart marker");
return gFalse;
}
if (++restartMarker == 0xd8)
restartMarker = 0xd0;
restart();
}
for (cc = 0; cc < numComps; ++cc) {
h = compInfo[cc].hSample;
v = compInfo[cc].vSample;
horiz = mcuWidth / h;
vert = mcuHeight / v;
hSub = horiz / 8;
vSub = vert / 8;
for (y2 = 0; y2 < mcuHeight; y2 += vert) {
for (x2 = 0; x2 < mcuWidth; x2 += horiz) {
if (unlikely(scanInfo.dcHuffTable[cc] >= 4) || unlikely(scanInfo.acHuffTable[cc] >= 4)) {
return gFalse;
}
if (!readDataUnit(&dcHuffTables[scanInfo.dcHuffTable[cc]],
&acHuffTables[scanInfo.acHuffTable[cc]],
&compInfo[cc].prevDC,
data1)) {
return gFalse;
}
transformDataUnit(quantTables[compInfo[cc].quantTable],
data1, data2);
if (hSub == 1 && vSub == 1) {
for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) {
p1 = &rowBuf[cc][y2+y3][x1+x2];
p1[0] = data2[i];
p1[1] = data2[i+1];
p1[2] = data2[i+2];
p1[3] = data2[i+3];
p1[4] = data2[i+4];
p1[5] = data2[i+5];
p1[6] = data2[i+6];
p1[7] = data2[i+7];
}
} else if (hSub == 2 && vSub == 2) {
for (y3 = 0, i = 0; y3 < 16; y3 += 2, i += 8) {
p1 = &rowBuf[cc][y2+y3][x1+x2];
p2 = &rowBuf[cc][y2+y3+1][x1+x2];
p1[0] = p1[1] = p2[0] = p2[1] = data2[i];
p1[2] = p1[3] = p2[2] = p2[3] = data2[i+1];
p1[4] = p1[5] = p2[4] = p2[5] = data2[i+2];
p1[6] = p1[7] = p2[6] = p2[7] = data2[i+3];
p1[8] = p1[9] = p2[8] = p2[9] = data2[i+4];
p1[10] = p1[11] = p2[10] = p2[11] = data2[i+5];
p1[12] = p1[13] = p2[12] = p2[13] = data2[i+6];
p1[14] = p1[15] = p2[14] = p2[15] = data2[i+7];
}
} else {
i = 0;
for (y3 = 0, y4 = 0; y3 < 8; ++y3, y4 += vSub) {
for (x3 = 0, x4 = 0; x3 < 8; ++x3, x4 += hSub) {
for (y5 = 0; y5 < vSub; ++y5)
for (x5 = 0; x5 < hSub; ++x5)
rowBuf[cc][y2+y4+y5][x1+x2+x4+x5] = data2[i];
++i;
}
}
}
}
}
}
--restartCtr;
if (colorXform) {
if (numComps == 3) {
for (y2 = 0; y2 < mcuHeight; ++y2) {
for (x2 = 0; x2 < mcuWidth; ++x2) {
pY = rowBuf[0][y2][x1+x2];
pCb = rowBuf[1][y2][x1+x2] - 128;
pCr = rowBuf[2][y2][x1+x2] - 128;
pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16;
rowBuf[0][y2][x1+x2] = dctClip[dctClipOffset + pR];
pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr + 32768) >> 16;
rowBuf[1][y2][x1+x2] = dctClip[dctClipOffset + pG];
pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16;
rowBuf[2][y2][x1+x2] = dctClip[dctClipOffset + pB];
}
}
} else if (numComps == 4) {
for (y2 = 0; y2 < mcuHeight; ++y2) {
for (x2 = 0; x2 < mcuWidth; ++x2) {
pY = rowBuf[0][y2][x1+x2];
pCb = rowBuf[1][y2][x1+x2] - 128;
pCr = rowBuf[2][y2][x1+x2] - 128;
pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16;
rowBuf[0][y2][x1+x2] = 255 - dctClip[dctClipOffset + pR];
pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr + 32768) >> 16;
rowBuf[1][y2][x1+x2] = 255 - dctClip[dctClipOffset + pG];
pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16;
rowBuf[2][y2][x1+x2] = 255 - dctClip[dctClipOffset + pB];
}
}
}
}
}
return gTrue;
}
|
CWE-119
| 4,020 | 13,875 |
139595222904998999289863604593921747367
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
int DCTStream::readMarker() {
int c;
do {
do {
c = str->getChar();
} while (c != 0xff && c != EOF);
while (c == 0xff) {
c = str->getChar();
}
} while (c == 0x00);
return c;
}
|
CWE-119
| 4,021 | 13,876 |
55997670536341670847082463469187124339
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable,
DCTHuffTable *acHuffTable,
int *prevDC, int data[64]) {
int run, size, amp, bit, c;
int i, j, k;
i = scanInfo.firstCoeff;
if (i == 0) {
if (scanInfo.ah == 0) {
if ((size = readHuffSym(dcHuffTable)) == 9999) {
return gFalse;
}
if (size > 0) {
if ((amp = readAmp(size)) == 9999) {
return gFalse;
}
} else {
amp = 0;
}
data[0] += (*prevDC += amp) << scanInfo.al;
} else {
if ((bit = readBit()) == 9999) {
return gFalse;
}
data[0] += bit << scanInfo.al;
}
++i;
}
if (scanInfo.lastCoeff == 0) {
return gTrue;
}
if (eobRun > 0) {
while (i <= scanInfo.lastCoeff) {
j = dctZigZag[i++];
if (data[j] != 0) {
if ((bit = readBit()) == EOF) {
return gFalse;
}
if (bit) {
data[j] += 1 << scanInfo.al;
}
}
}
--eobRun;
return gTrue;
}
while (i <= scanInfo.lastCoeff) {
if ((c = readHuffSym(acHuffTable)) == 9999) {
return gFalse;
}
if (c == 0xf0) {
k = 0;
while (k < 16 && i <= scanInfo.lastCoeff) {
j = dctZigZag[i++];
if (data[j] == 0) {
++k;
} else {
if ((bit = readBit()) == EOF) {
return gFalse;
}
if (bit) {
data[j] += 1 << scanInfo.al;
}
}
}
} else if ((c & 0x0f) == 0x00) {
j = c >> 4;
eobRun = 0;
for (k = 0; k < j; ++k) {
if ((bit = readBit()) == EOF) {
return gFalse;
}
eobRun = (eobRun << 1) | bit;
}
eobRun += 1 << j;
while (i <= scanInfo.lastCoeff) {
j = dctZigZag[i++];
if (data[j] != 0) {
if ((bit = readBit()) == EOF) {
return gFalse;
}
if (bit) {
data[j] += 1 << scanInfo.al;
}
}
}
--eobRun;
break;
} else {
run = (c >> 4) & 0x0f;
size = c & 0x0f;
if ((amp = readAmp(size)) == 9999) {
return gFalse;
}
j = 0; // make gcc happy
for (k = 0; k <= run && i <= scanInfo.lastCoeff; ++k) {
j = dctZigZag[i++];
while (data[j] != 0 && i <= scanInfo.lastCoeff) {
if ((bit = readBit()) == EOF) {
return gFalse;
}
if (bit) {
data[j] += 1 << scanInfo.al;
}
j = dctZigZag[i++];
}
}
data[j] = amp << scanInfo.al;
}
}
return gTrue;
}
|
CWE-119
| 4,022 | 13,877 |
271810172461896656092677367962760445693
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool DCTStream::readQuantTables() {
int length, prec, i, index;
length = read16() - 2;
while (length > 0) {
index = str->getChar();
prec = (index >> 4) & 0x0f;
index &= 0x0f;
if (prec > 1 || index >= 4) {
error(errSyntaxError, getPos(), "Bad DCT quantization table");
return gFalse;
}
if (index == numQuantTables) {
numQuantTables = index + 1;
}
for (i = 0; i < 64; ++i) {
if (prec) {
quantTables[index][dctZigZag[i]] = read16();
} else {
quantTables[index][dctZigZag[i]] = str->getChar();
}
}
if (prec) {
length -= 129;
} else {
length -= 65;
}
}
return gTrue;
}
|
CWE-119
| 4,023 | 13,878 |
210836322898344887905842323867915516232
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
GBool DCTStream::readRestartInterval() {
int length;
length = read16();
if (length != 4) {
error(errSyntaxError, getPos(), "Bad DCT restart interval");
return gFalse;
}
restartInterval = read16();
return gTrue;
}
|
CWE-119
| 4,024 | 13,879 |
242407456662503424131397477864021119136
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void DCTStream::readScan() {
int data[64];
int x1, y1, dx1, dy1, x2, y2, y3, cc, i;
int h, v, horiz, vert, vSub;
int *p1;
int c;
if (scanInfo.numComps == 1) {
for (cc = 0; cc < numComps; ++cc) {
if (scanInfo.comp[cc]) {
break;
}
}
dx1 = mcuWidth / compInfo[cc].hSample;
dy1 = mcuHeight / compInfo[cc].vSample;
} else {
dx1 = mcuWidth;
dy1 = mcuHeight;
}
for (y1 = 0; y1 < height; y1 += dy1) {
for (x1 = 0; x1 < width; x1 += dx1) {
if (restartInterval > 0 && restartCtr == 0) {
c = readMarker();
if (c != restartMarker) {
error(errSyntaxError, getPos(),
"Bad DCT data: incorrect restart marker");
return;
}
if (++restartMarker == 0xd8) {
restartMarker = 0xd0;
}
restart();
}
for (cc = 0; cc < numComps; ++cc) {
if (!scanInfo.comp[cc]) {
continue;
}
h = compInfo[cc].hSample;
v = compInfo[cc].vSample;
horiz = mcuWidth / h;
vert = mcuHeight / v;
vSub = vert / 8;
for (y2 = 0; y2 < dy1; y2 += vert) {
for (x2 = 0; x2 < dx1; x2 += horiz) {
p1 = &frameBuf[cc][(y1+y2) * bufWidth + (x1+x2)];
for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) {
data[i] = p1[0];
data[i+1] = p1[1];
data[i+2] = p1[2];
data[i+3] = p1[3];
data[i+4] = p1[4];
data[i+5] = p1[5];
data[i+6] = p1[6];
data[i+7] = p1[7];
p1 += bufWidth * vSub;
}
if (progressive) {
if (!readProgressiveDataUnit(
&dcHuffTables[scanInfo.dcHuffTable[cc]],
&acHuffTables[scanInfo.acHuffTable[cc]],
&compInfo[cc].prevDC,
data)) {
return;
}
} else {
if (!readDataUnit(&dcHuffTables[scanInfo.dcHuffTable[cc]],
&acHuffTables[scanInfo.acHuffTable[cc]],
&compInfo[cc].prevDC,
data)) {
return;
}
}
p1 = &frameBuf[cc][(y1+y2) * bufWidth + (x1+x2)];
for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) {
p1[0] = data[i];
p1[1] = data[i+1];
p1[2] = data[i+2];
p1[3] = data[i+3];
p1[4] = data[i+4];
p1[5] = data[i+5];
p1[6] = data[i+6];
p1[7] = data[i+7];
p1 += bufWidth * vSub;
}
}
}
}
--restartCtr;
}
}
}
|
CWE-119
| 4,025 | 13,880 |
328314076742108596365417240833688086752
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
void FlateStream::readSome() {
int code1, code2;
int len, dist;
int i, j, k;
int c;
if (endOfBlock) {
if (!startBlock())
return;
}
if (compressedBlock) {
if ((code1 = getHuffmanCodeWord(&litCodeTab)) == EOF)
goto err;
if (code1 < 256) {
buf[index] = code1;
remain = 1;
} else if (code1 == 256) {
endOfBlock = gTrue;
remain = 0;
} else {
code1 -= 257;
code2 = lengthDecode[code1].bits;
if (code2 > 0 && (code2 = getCodeWord(code2)) == EOF)
goto err;
len = lengthDecode[code1].first + code2;
if ((code1 = getHuffmanCodeWord(&distCodeTab)) == EOF)
goto err;
code2 = distDecode[code1].bits;
if (code2 > 0 && (code2 = getCodeWord(code2)) == EOF)
goto err;
dist = distDecode[code1].first + code2;
i = index;
j = (index - dist) & flateMask;
for (k = 0; k < len; ++k) {
buf[i] = buf[j];
i = (i + 1) & flateMask;
j = (j + 1) & flateMask;
}
remain = len;
}
} else {
len = (blockLen < flateWindow) ? blockLen : flateWindow;
for (i = 0, j = index; i < len; ++i, j = (j + 1) & flateMask) {
if ((c = str->getChar()) == EOF) {
endOfBlock = eof = gTrue;
break;
}
buf[j] = c & 0xff;
}
remain = i;
blockLen -= len;
if (blockLen == 0)
endOfBlock = gTrue;
}
return;
err:
error(errSyntaxError, getPos(), "Unexpected end of file in flate stream");
endOfBlock = eof = gTrue;
remain = 0;
}
|
CWE-119
| 4,027 | 13,881 |
232217302658866683793950327768482340285
| null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.