Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2402)

Unified Diff: core/src/fxcodec/codec/fx_codec_flate.cpp

Issue 466153005: Fix buffer size offset error in PNG_Predictor (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/codec/fx_codec_flate.cpp
diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp
index c02f0977cf858c94fb25c1c20da837f445739984..a12fffbe5ced0341c96cbf26a44915ffdedf01ec 100644
--- a/core/src/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/src/fxcodec/codec/fx_codec_flate.cpp
@@ -398,6 +398,7 @@ static void PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size,
FX_LPBYTE pDestData = dest_buf;
for (int row = 0; row < row_count; row ++) {
FX_BYTE tag = pSrcData[0];
+ byte_cnt++;
if (tag == 0) {
int move_size = row_size;
if ((row + 1) * (move_size + 1) > (int)data_size) {
@@ -406,7 +407,7 @@ static void PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size,
FXSYS_memmove32(pDestData, pSrcData + 1, move_size);
pSrcData += move_size + 1;
pDestData += move_size;
- byte_cnt += move_size + 1;
+ byte_cnt += move_size;
continue;
}
for (int byte = 0; byte < row_size && byte_cnt < (int)data_size; byte ++) {
@@ -464,7 +465,6 @@ static void PNG_Predictor(FX_LPBYTE& data_buf, FX_DWORD& data_size,
}
pSrcData += row_size + 1;
pDestData += row_size;
- byte_cnt++;
}
FX_Free(data_buf);
data_buf = dest_buf;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698