Skip to content

Commit 8a05766

Browse files
committed
[libpng16] Fix the calculation of row_factor in png_check_chunk_length
(Bug report by Thuan Pham, SourceForge issue #278)
1 parent a74aa9a commit 8a05766

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: pngrutil.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -3167,10 +3167,13 @@ png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
31673167
{
31683168
png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
31693169
size_t row_factor =
3170-
(png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
3171-
+ 1 + (png_ptr->interlaced? 6: 0));
3170+
(size_t)png_ptr->width
3171+
* (size_t)png_ptr->channels
3172+
* (png_ptr->bit_depth > 8? 2: 1)
3173+
+ 1
3174+
+ (png_ptr->interlaced? 6: 0);
31723175
if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
3173-
idat_limit=PNG_UINT_31_MAX;
3176+
idat_limit = PNG_UINT_31_MAX;
31743177
else
31753178
idat_limit = png_ptr->height * row_factor;
31763179
row_factor = row_factor > 32566? 32566 : row_factor;

0 commit comments

Comments
 (0)