summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-08-22 09:45:59 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2016-08-22 09:45:59 (GMT)
commit4fd92297e0a144881f37ffdb1c19fab6b0d3e47d (patch)
treef1db587da24c607cdfcd26c388b417cc4f8f2173
parent14f1814ca437de24d3807f13c824058b28601249 (diff)
downloadlibnsbmp-4fd92297e0a144881f37ffdb1c19fab6b0d3e47d.tar.gz
libnsbmp-4fd92297e0a144881f37ffdb1c19fab6b0d3e47d.tar.bz2
deal with unrepresentable negative heights in bitmap info header
-rw-r--r--src/libnsbmp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libnsbmp.c b/src/libnsbmp.c
index b9bd8f5..c03d34b 100644
--- a/src/libnsbmp.c
+++ b/src/libnsbmp.c
@@ -180,7 +180,11 @@ static bmp_result bmp_info_header_parse(bmp_image *bmp, uint8_t *data)
return BMP_DATA_ERROR;
if (height < 0) {
bmp->reversed = true;
- height = -height;
+ if (height <= -INT32_MAX) {
+ height = INT32_MAX;
+ } else {
+ height = -height;
+ }
}
/* ICOs only support 256*256 resolutions
* In the case of the ICO header, the height is actually the added