Skip to content

Commit 1ecd9a5

Browse files
committed
Handle NULL buffer when discarding rows
1 parent 3212005 commit 1ecd9a5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

jdpostct.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ post_process_1pass (j_decompress_ptr cinfo,
132132
my_post_ptr post = (my_post_ptr) cinfo->post;
133133
JDIMENSION num_rows, max_rows;
134134

135+
/* read_and_discard_scanlines may call it with rows "available", but no buffer */
136+
if (output_buf == NULL) {
137+
return;
138+
}
139+
135140
/* Fill the buffer, but not more than what we can dump out in one go. */
136141
/* Note we rely on the upsampler to detect bottom of image. */
137142
max_rows = out_rows_avail - *out_row_ctr;

jquant1.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,10 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
531531
JDIMENSION col;
532532
JDIMENSION width = cinfo->output_width;
533533

534+
if (output_buf == NULL && num_rows) {
535+
ERREXIT(cinfo, JERR_BAD_PARAM);
536+
}
537+
534538
for (row = 0; row < num_rows; row++) {
535539
/* Initialize output values to 0 so can process components separately */
536540
jzero_far((void *) output_buf[row], (size_t) (width * sizeof(JSAMPLE)));

0 commit comments

Comments
 (0)