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

--HG--
branch : GECKO1001_2012020805_RELBRANCH
extra : transplant_source : %BDa%1A1%15%B0%D1%D2J%CF-j%C2%9D%84%7C%18%AF%B5%C4
  • Loading branch information
bsmedberg committed Feb 16, 2012
1 parent 0e87462 commit 019a561
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 019a561

Please sign in to comment.