summaryrefslogtreecommitdiff
path: root/src/gd_bmp.c
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2021-09-07 22:03:21 +0700
committerPierre Joye <pierre.php@gmail.com>2021-09-07 22:03:21 +0700
commite5c84f0b7a2e2cef8d8630bd8c26a2f859e959ff (patch)
tree1dda6178346aa7984c904b3aa08744cb11592ecb /src/gd_bmp.c
parentc80a7bf3ff448c627335135c5e9cffae83d49d21 (diff)
downloadlibgd-e5c84f0b7a2e2cef8d8630bd8c26a2f859e959ff.tar.gz
Partial fix for #750
Diffstat (limited to 'src/gd_bmp.c')
-rw-r--r--src/gd_bmp.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gd_bmp.c b/src/gd_bmp.c
index e186ac9..29a05ce 100644
--- a/src/gd_bmp.c
+++ b/src/gd_bmp.c
@@ -266,7 +266,11 @@ static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
bitmap_size += compressed_size;
- gdPutBuf(uncompressed_row, compressed_size, out);
+ if (gdPutBuf(uncompressed_row, compressed_size, out) != compressed_size){
+ gd_error("gd-bmp write error\n");
+ error = 1;
+ break;
+ }
gdPutC(BMP_RLE_COMMAND, out);
gdPutC(BMP_RLE_ENDOFLINE, out);
bitmap_size += 2;
@@ -322,10 +326,14 @@ static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
}
while ((buffer_size = gdGetBuf(copy_buffer, 1024, out)) != EOF) {
+ int res;
if (buffer_size == 0) {
break;
}
- gdPutBuf(copy_buffer , buffer_size, out_original);
+ if (gdPutBuf(copy_buffer , buffer_size, out_original) != buffer_size) {
+ gd_error("gd-bmp write error\n");
+ error = 1;
+ }
}
gdFree(copy_buffer);
@@ -335,7 +343,7 @@ static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
out_original = NULL;
}
- ret = 0;
+ ret = error;
cleanup:
if (tmpfile_for_compression) {
#ifdef _WIN32