summaryrefslogtreecommitdiff
path: root/core/fxcodec/lbmp
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-11-28 09:31:22 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-28 09:31:22 -0800
commite421327725da2fbc713b52ea0e623f67d7bcbcaa (patch)
tree15399c5449a46cb2edc79e1aa32df6c7bc12c069 /core/fxcodec/lbmp
parent0354ccf37f05f25b1bf64fd60bb3b48efab4d7d0 (diff)
downloadpdfium-e421327725da2fbc713b52ea0e623f67d7bcbcaa.tar.xz
Replace ASSERT with error return in bmp_read_header
The width and compress flag are read, so returning with error is more appropriate than having an ASSERT. BUG=659497 Review-Url: https://codereview.chromium.org/2535863002
Diffstat (limited to 'core/fxcodec/lbmp')
-rw-r--r--core/fxcodec/lbmp/fx_bmp.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/core/fxcodec/lbmp/fx_bmp.cpp b/core/fxcodec/lbmp/fx_bmp.cpp
index 9105c6ed9c..fb64b36560 100644
--- a/core/fxcodec/lbmp/fx_bmp.cpp
+++ b/core/fxcodec/lbmp/fx_bmp.cpp
@@ -171,8 +171,10 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
return 0;
}
}
- ASSERT(bmp_ptr->width > 0);
- ASSERT(bmp_ptr->compress_flag <= BMP_BITFIELDS);
+ if (bmp_ptr->width <= 0 || bmp_ptr->compress_flag > BMP_BITFIELDS) {
+ bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
+ return 0;
+ }
switch (bmp_ptr->bitCounts) {
case 1:
case 4:
@@ -184,12 +186,8 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) {
return 0;
}
}
- case 32: {
- if (bmp_ptr->width <= 0 || bmp_ptr->compress_flag > BMP_BITFIELDS) {
- bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
- return 0;
- }
- } break;
+ case 32:
+ break;
default:
bmp_error(bmp_ptr, "The Bmp File Is Corrupt");
return 0;