#46433 [Bgs]: imagecreatefrom(...) leaks memory on errors
| From: | pajoye@php.net | Date: | Tue, 16 Jun 2009 16:16:37 +0000 |
| Subject: | #46433 [Bgs]: imagecreatefrom(...) leaks memory on errors | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-138365@lists.php.net to get a copy of this message | ||
ID: 46433
Updated by: pajoye@php.net
Reported By: ak at pre-secure dot de
Status: Bogus
Bug Type: GD related
Operating System: Linux (OpenSUSE)
PHP Version: 5.2.9
Assigned To: pajoye
New Comment:
I already said that it was working here.
pierre@ubuntu:~/cvs/php53/bld$ ./sapi/cli/php -r
"imagecreatefrompng('http://drahop.de/php/anyimage.png');"
Warning: imagecreatefrompng(): gd-png: fatal libpng error: IDAT: CRC
error in Command line code on line 1
Warning: imagecreatefrompng(): gd-png error: setjmp returns error
condition in Command line code on line 1
Warning: imagecreatefrompng(): 'http://drahop.de/php/anyimage.png' is
not a valid PNG file in Command line code on line 1
There is no error either through valgrind.
And yes, the memory usage of PHP MM increases as you keep creating
errors, but the memory is freed when it exits >> no leak.
If you read the valgrind output you pasted here, you will see that it
did not find any error either...
Previous Comments:
------------------------------------------------------------------------
[2009-06-16 15:42:14] ak at pre-secure dot de
Did you at least try to reproduce it? I tested it on various machines
with the given script and image. It will crash in no time cause it
allocates to much memory.
------------------------------------------------------------------------
[2009-06-16 15:14:08] pajoye@php.net
==18171== ERROR SUMMARY: 0 errors from 0 contexts
No error. Still bogus.
------------------------------------------------------------------------
[2009-06-16 13:35:21] ak at pre-secure dot de
==18171== Memcheck, a memory error detector.
==18171== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
al.
==18171== Using LibVEX rev 1854, a library for dynamic binary
translation.
==18171== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==18171== Using valgrind-3.3.1, a dynamic binary instrumentation
framework.
==18171== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
al.
==18171== For more details, rerun with: -v
==18171==
Memory: 104664PHP Warning: imagecreatefrompng(): gd-png: fatal libpng
error: IDAT: CRC error in /srv/www/htdocs/ak/memtest.php on line 5
PHP Warning: imagecreatefrompng(): gd-png error: setjmp returns error
condition in /srv/www/htdocs/ak/memtest.php on line 5
PHP Warning: imagecreatefrompng(): 'anyimage.png' is not a valid PNG
file in /srv/www/htdocs/ak/memtest.php on line 5
==18171==
==18171== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 96 from
2)
==18171== malloc/free: in use at exit: 7,917 bytes in 15 blocks.
==18171== malloc/free: 13,027 allocs, 13,012 frees, 4,751,157 bytes
allocated.
==18171== For counts of detected errors, rerun with: -v
==18171== searching for pointers to 15 not-freed blocks.
==18171== checked 525,192 bytes.
==18171==
==18171== LEAK SUMMARY:
==18171== definitely lost: 0 bytes in 0 blocks.
==18171== possibly lost: 0 bytes in 0 blocks.
==18171== still reachable: 7,917 bytes in 15 blocks.
==18171== suppressed: 0 bytes in 0 blocks.
==18171== Rerun with --leak-check=full to see details of leaked memory.
------------------------------------------------------------------------
[2009-06-11 13:17:46] pajoye@php.net
Run a single pass through valgrind please.
------------------------------------------------------------------------
[2009-06-11 13:11:42] ak at pre-secure dot de
I was able to reproduce the Problem with the current release. It occurs
if you try to open an image with an crc error.
Reproduce code:
---------------
while(true) {
print "\nMemory: ".memory_get_usage();
imagecreatefrompng("anyimage.png");
}
Image:
--------------
http://drahop.de/php/anyimage.png
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/46433
--
Edit this bug report at http://bugs.php.net/?id=46433&edit=1