Merge pull request #5669 from fkaelberer/avoidOutOfRangeArrayAccessInJbig2Decoder

Avoid out of range array access in JBIG2 decoder
This commit is contained in:
Tim van der Meij 2015-01-26 19:10:07 +01:00
commit 40f9f771c0

View File

@ -179,10 +179,9 @@ var Jbig2Image = (function Jbig2ImageClosure() {
// At each pixel: Clear contextLabel pixels that are shifted
// out of the context, then add new ones.
// If j + n is out of range at the right image border, then
// the undefined value of bitmap[i - 2][j + n] is shifted to 0
contextLabel = ((contextLabel & OLD_PIXEL_MASK) << 1) |
(row2[j + 3] << 11) | (row1[j + 4] << 4) | pixel;
(j + 3 < width ? row2[j + 3] << 11 : 0) |
(j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
}
}