Bug #74481 [Com]: segfault getimagesize using zip:// stream

From: Date: Tue, 25 Apr 2017 11:33:28 +0000
Subject: Bug #74481 [Com]: segfault getimagesize using zip:// stream
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208782@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74481&edit=1

 ID:                 74481
 Comment by:         info at team-grasshopper dot info
 Reported by:        sergey dot kudich at gmail dot com
 Summary:            segfault getimagesize using zip:// stream
 Status:             Feedback
 Type:               Bug
 Package:            GetImageSize related
 Operating System:   Ceontos 7
 PHP Version:        7.0.18
 Block user comment: N
 Private report:     N

 New Comment:

It is the same problem as php 5.6, so I will send a core dump.

#0  0x000000000059dafc in php_stream_context_get_option (context=0x0, wrappername=0x7f5c5d3e8ce3
"zip", 
    optionname=0x7f5c5d3e987a "password", optionvalue=0x7fffb7bd4d30) at
/usr/src/debug/php-5.6.30/main/streams/streams.c:2227
#1  0x00007f5c5d3e89e6 in php_stream_zip_opener () from
/opt/remi/php56/root/usr/lib64/php/modules/zip.so
#2  0x000000000059f793 in _php_stream_open_wrapper_ex (
    path=0x7f5c6def5258
"zip:///home/quotation_invoice/dev/qi/aaa/quotation_000.xlsx#xl/media/image11.wmf",
mode=0x6dce67 "rb", 
    options=24, opened_path=0x0, context=0x0) at
/usr/src/debug/php-5.6.30/main/streams/streams.c:2059
#3  0x0000000000544253 in php_getimagesize_from_any (ht=1, return_value=0x7f5c6def4160,
return_value_ptr=<value optimized out>, 
    this_ptr=<value optimized out>, return_value_used=<value optimized out>, mode=1)
    at /usr/src/debug/php-5.6.30/ext/standard/image.c:1408
#4  0x00000000005d9479 in dtrace_execute_internal (execute_data_ptr=<value optimized out>,
fci=<value optimized out>, 
    return_value_used=<value optimized out>) at
/usr/src/debug/php-5.6.30/Zend/zend_dtrace.c:97
#5  0x00000000006689d5 in zend_do_fcall_common_helper_SPEC (execute_data=<value optimized
out>)
    at /usr/src/debug/php-5.6.30/Zend/zend_vm_execute.h:560
#6  0x00000000006584a8 in execute_ex (execute_data=0x7f5c6dec0238) at
/usr/src/debug/php-5.6.30/Zend/zend_vm_execute.h:363
#7  0x00000000005d95ae in dtrace_execute_ex (execute_data=0x7f5c6dec0238) at
/usr/src/debug/php-5.6.30/Zend/zend_dtrace.c:73
#8  0x00000000005e8d5c in zend_execute_scripts (type=8, retval=0x0, file_count=3) at
/usr/src/debug/php-5.6.30/Zend/zend.c:1341
#9  0x000000000058690a in php_execute_script (primary_file=0x7fffb7bd8730) at
/usr/src/debug/php-5.6.30/main/main.c:2613
#10 0x0000000000690b76 in do_cli (argc=2, argv=0x2636c90) at
/usr/src/debug/php-5.6.30/sapi/cli/php_cli.c:998
#11 0x0000000000691308 in main (argc=2, argv=0x2636c90) at
/usr/src/debug/php-5.6.30/sapi/cli/php_cli.c:1382


Previous Comments:
------------------------------------------------------------------------
[2017-04-20 14:50:12] danack@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.



------------------------------------------------------------------------
[2017-04-20 14:40:25] sergey dot kudich at gmail dot com

Description:
------------
Segmentation Fault if we try getimagesize on zip:// strem

All was ok on php 7.0.16, this is related to phpoffice/phpexcel library

example - just try any file to open, we tried to get image from excel file so putting here example
for it
getimagesize('zip:///home/user/workbook.xlsx#xl/media/image1.gif');

If we trying to open this file via fopen
$h = fopen('zip:///home/user/workbook.xlsx#xl/media/image1.gif', 'br');

PHP Warning:  fopen(zip:///home/user/workbook.xlsx#xl/media/image1.gif): failed to open stream:
operation failed in ...

Same time file_get_contents working well



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74481&edit=1


Thread (8 messages)

« previous php.bugs (#208782) next »