Fix assertion failure when decoding malform G4 fax image The position indexes of color elements must be monotonic increasing. Bail out if the decoded index is less or equal to the previous index. BUG=pdfium:615 Review-Url: https://codereview.chromium.org/2398033002
diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp index 336c35b..c121478 100644 --- a/core/fxcodec/codec/fx_codec_fax.cpp +++ b/core/fxcodec/codec/fx_codec_fax.cpp
@@ -390,6 +390,10 @@ if (a1 >= columns) return TRUE; + // The position of picture element must be monotonic increasing. + if (a0 >= a1) + return FALSE; + a0 = a1; a0color = !a0color; }