summaryrefslogtreecommitdiffstats
path: root/common/jpeg/jdatadst.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/jpeg/jdatadst.c')
-rw-r--r--common/jpeg/jdatadst.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/jpeg/jdatadst.c b/common/jpeg/jdatadst.c
index a8f6fb0e..b8748154 100644
--- a/common/jpeg/jdatadst.c
+++ b/common/jpeg/jdatadst.c
@@ -82,8 +82,9 @@ empty_output_buffer (j_compress_ptr cinfo)
{
my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
- if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) !=
- (size_t) OUTPUT_BUF_SIZE)
+ if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE
+ - dest->pub.free_in_buffer) !=
+ (size_t) (OUTPUT_BUF_SIZE - dest->pub.free_in_buffer))
ERREXIT(cinfo, JERR_FILE_WRITE);
dest->pub.next_output_byte = dest->buffer;