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

Unified Diff: core/fxcodec/codec/fx_codec_fax.cpp

Issue 2369433002: Bail out on negative a0 values in FaxG4GetRow(). (Closed)
Patch Set: Created 4 years, 3 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/fxcodec/codec/fx_codec_fax.cpp
diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp
index c0202829ee55312bdf3feb9c241aa4743156880c..b1f02c559b4398217e0da3bad30a8746d8e22e65 100644
--- a/core/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/fxcodec/codec/fx_codec_fax.cpp
@@ -337,10 +337,9 @@ FX_BOOL FaxG4GetRow(const uint8_t* src_buf,
FaxFillBits(dest_buf, columns, a1, a2);
}
a0 = a2;
- if (a0 < columns) {
- continue;
- }
- return TRUE;
+ if (a0 < 0 && a0 >= columns)
+ return TRUE;
+ continue;
} else {
if (bitpos >= bitsize) {
return FALSE;
@@ -350,10 +349,9 @@ FX_BOOL FaxG4GetRow(const uint8_t* src_buf,
if (!a0color) {
FaxFillBits(dest_buf, columns, a0, b2);
}
- if (b2 >= columns) {
- return TRUE;
- }
a0 = b2;
+ if (a0 < 0 || a0 >= columns)
+ return TRUE;
continue;
} else {
if (bitpos >= bitsize) {
@@ -398,10 +396,9 @@ FX_BOOL FaxG4GetRow(const uint8_t* src_buf,
if (!a0color) {
FaxFillBits(dest_buf, columns, a0, a1);
}
- if (a1 >= columns) {
- return TRUE;
- }
a0 = a1;
+ if (a0 < 0 || a0 >= columns)
+ return TRUE;
a0color = !a0color;
}
}
« 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