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

Unified Diff: core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp

Issue 1840483003: Reduce signed/unsigned comparison warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 9 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 | « core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp ('k') | core/fpdftext/fpdf_text_int.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index 219a72507b7a9f80ae2626a3f14ff9858b21eab4..346476b62b0d92f534b9c68f8cac17144f6d7fbd 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -176,24 +176,21 @@ uint32_t RunLengthDecode(const uint8_t* src_buf,
if (src_buf[i] < 128) {
old = dest_size;
dest_size += src_buf[i] + 1;
- if (dest_size < old) {
- return static_cast<uint32_t>(-1);
- }
+ if (dest_size < old)
+ return FX_INVALID_OFFSET;
i += src_buf[i] + 2;
} else if (src_buf[i] > 128) {
old = dest_size;
dest_size += 257 - src_buf[i];
- if (dest_size < old) {
- return static_cast<uint32_t>(-1);
- }
+ if (dest_size < old)
+ return FX_INVALID_OFFSET;
i += 2;
} else {
break;
}
}
- if (dest_size >= _STREAM_MAX_SIZE_) {
- return static_cast<uint32_t>(-1);
- }
+ if (dest_size >= _STREAM_MAX_SIZE_)
+ return FX_INVALID_OFFSET;
dest_buf = FX_Alloc(uint8_t, dest_size);
i = 0;
int dest_count = 0;
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp ('k') | core/fpdftext/fpdf_text_int.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698