php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72090 AddressSanitizer: SEGV on unknown address 0x00000000 gdImageFlipVertical
Submitted: 2016-04-24 01:02 UTC Modified: 2016-08-04 14:24 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: fernando at null-life dot com Assigned: cmb (profile)
Status: Not a bug Package: GD related
PHP Version: 5.6.20 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fernando at null-life dot com
New email:
PHP Version: OS:

 

 [2016-04-24 01:02 UTC] fernando at null-life dot com
Description:
------------
Run with ASAN

Test script:
---------------
<?php

$var1 = imagecreatetruecolor ( 10, 10);
imagegd($var1);
imageflip($var1,2);


Expected result:
----------------
Not crash

Actual result:
--------------
ASAN:SIGSEGV
=================================================================
==1805==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000 (pc 0xb2a4147f bp 0xbf832b60 sp 0xbf832b24 T0)
    #0 0xb2a4147e in gdImageFlipVertical (/usr/lib/i386-linux-gnu/libgd.so.3+0xf47e)
    #1 0xb2ac02e8 in zif_imageflip /home/fmunozs/phpgit/php56/ext/gd/gd.c:4944
    #2 0x9a7c718 in zend_do_fcall_common_helper_SPEC /home/fmunozs/phpgit/php56/Zend/zend_vm_execute.h:558
    #3 0x9640316 in execute_ex /home/fmunozs/phpgit/php56/Zend/zend_vm_execute.h:363
    #4 0x9a6c9c8 in zend_execute /home/fmunozs/phpgit/php56/Zend/zend_vm_execute.h:388
    #5 0x9470b59 in zend_execute_scripts /home/fmunozs/phpgit/php56/Zend/zend.c:1341
    #6 0x91acc6b in php_execute_script /home/fmunozs/phpgit/php56/main/main.c:2613
    #7 0x9a8648a in do_cli /home/fmunozs/phpgit/php56/sapi/cli/php_cli.c:994
    #8 0x808a502 in main /home/fmunozs/phpgit/php56/sapi/cli/php_cli.c:1378
    #9 0xb6e2f645 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x18645)
    #10 0x808aaba  (/home/fmunozs/phpgit/php56/sapi/cli/php+0x808aaba)



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-23 18:18 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-07-23 18:18 UTC] cmb@php.net
> SEGV on unknown address 0x00000000

Sounds like a null pointer access, but I can't reproduce that, and
valgrind also doesn't complain.

Which libgd do you use? (see phpinfo)
 [2016-07-31 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2016-08-04 11:49 UTC] fernando at null-life dot com
I don't have this debugging version anymore, however using ubuntu xenial current packages the issue can be reproduced:

user@Xenial32-2:~$ php poc.php
??

????Segmentation fault
user@Xenial32-2:~$ php -v 
PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.8-0ubuntu0.16.04.2, Copyright (c) 1999-2016, by Zend Technologies
user@Xenial32-2:~$ php -r "var_dump(gd_info());"
array(12) {
  ["GD Version"]=>
  string(5) "2.1.1"
  ["FreeType Support"]=>
  bool(true)
  ["FreeType Linkage"]=>
  string(13) "with freetype"
  ["GIF Read Support"]=>
  bool(true)
  ["GIF Create Support"]=>
  bool(true)
  ["JPEG Support"]=>
  bool(true)
  ["PNG Support"]=>
  bool(true)
  ["WBMP Support"]=>
  bool(true)
  ["XPM Support"]=>
  bool(true)
  ["XBM Support"]=>
  bool(true)
  ["WebP Support"]=>
  bool(true)
  ["JIS-mapped Japanese Font Support"]=>
  bool(false)
}
 [2016-08-04 12:07 UTC] cmb@php.net
-Status: No Feedback +Status: Open
 [2016-08-04 12:07 UTC] cmb@php.net
> ["GD Version"]=>
> string(5) "2.1.1"

Ah, a system libgd. I'll try to reproduce.
 [2016-08-04 14:24 UTC] cmb@php.net
-Status: Assigned +Status: Not a bug
 [2016-08-04 14:24 UTC] cmb@php.net
Actually, this issue happens only with libgd 2.1.1 and earlier. It
has been fixed as of libgd 2.2.0[1]. PHP's bundled libgd never was
affected.

[1] <https://github.com/libgd/libgd/commit/c9dac2d>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 21:01:29 2024 UTC