Skip to content

Commit 38df1c3

Browse files
glebmslouken
authored andcommitted
miniz.h: do not overallocate out_buf
1 parent 093fbfd commit 38df1c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/video/miniz.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2920,7 +2920,7 @@ MINIZ_STATIC void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage
29202920
tdefl_compressor *pComp = (tdefl_compressor *)MZ_MALLOC(sizeof(tdefl_compressor)); tdefl_output_buffer out_buf; int i, y, z = 0; mz_uint32 c; *pLen_out = 0; size_t data_start, data_size;
29212921
if (!pComp) return NULL;
29222922
MZ_CLEAR_OBJ(out_buf); out_buf.m_expandable = MZ_TRUE;
2923-
out_buf.m_capacity = 57+MZ_MAX(64, (1+bpl)*h);
2923+
out_buf.m_capacity = 57+MZ_MAX(64, (1+w*num_chans)*h);
29242924
if (plte_size > 0)
29252925
out_buf.m_capacity += 12+plte_size;
29262926
if (trns_size > 0)

0 commit comments

Comments
 (0)