Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Bug 727401 - import libpng overflow patch from http://codereview.chro…
Browse files Browse the repository at this point in the history
…mium.org/9363013 r=joe, a=akeybl CLOSED TREE
  • Loading branch information
bsmedberg committed Feb 16, 2012
1 parent e5a7413 commit b6c34ce
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions media/libpng/pngrutil.c
Expand Up @@ -401,8 +401,15 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
{
/* Success (maybe) - really uncompress the chunk. */
png_size_t new_size = 0;
png_charp text = png_malloc_warn(png_ptr,
prefix_size + expanded_size + 1);
png_charp text = NULL;
/* Need to check for both truncation (64-bit platforms) and integer
* overflow.
*/
if (prefix_size + expanded_size > prefix_size &&
prefix_size + expanded_size < 0xffffffffU)
{
text = png_malloc_warn(png_ptr, prefix_size + expanded_size + 1);
}

if (text != NULL)
{
Expand Down

0 comments on commit b6c34ce

Please sign in to comment.