|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8454 SegFault occurs using pdf_open_image_file
Submitted: 2000-12-28 11:08 UTC Modified: 2001-01-03 13:17 UTC
From: wirtz at web-active dot com Assigned:
Status: Closed Package: PDF related
PHP Version: 4.0.4 OS: Linux 2.2.13 i586
Private report: No CVE-ID: None
 [2000-12-28 11:08 UTC] wirtz at web-active dot com
Okay, the following script is generating the SegFault:
$fp = tmpfile();
$pdfp = pdf_open( $fp );
pdf_begin_page( $pdfp, 595, 842 );
$pim = pdf_open_image_file( $pdfp, "jpeg", "test.jpg" );
pdf_place_image( $pdfp, $pim, 0, 0, 1.0 );
pdf_close_image( $pdfp, $pim );
pdf_end_page( $pdfp );
pdf_close( $pdfp );
rewind( $fp );
header( "Content-type: application/pdf" );
fpassthru( $fp );
fclose( $fp );


Libs used:
pdf 3.02
zlib 1.1.3
jpeg 6b
png 1.0.8
tiff 3.5.5

and the backtrace looks like this:
Starting program: php pdftest.php

Program received signal SIGSEGV, Segmentation fault.
0x401beb24 in memcpy (dstpp=0x8186ba0, srcpp=0x0, len=1)
    at ../sysdeps/generic/memcpy.c:61
61      ../sysdeps/generic/memcpy.c: No such file or directory.
(gdb) bt
#0  0x401beb24 in memcpy (dstpp=0x8186ba0, srcpp=0x0, len=1)
    at ../sysdeps/generic/memcpy.c:61
#1  0x80ce9cc in virtual_filepath_ex (path=0x8186b8c "test.tif",
    filepath=0xbfffe020, verify_path=0x80ce0d0 <php_is_file_ok>)
    at tsrm_virtual_cwd.c:461
#2  0x80cea05 in virtual_filepath (path=0x8186b8c "test.tif",
    filepath=0xbfffe020) at tsrm_virtual_cwd.c:472
#3  0x8087371 in php_if_pdf_open_image_file (ht=3, return_value=0x8186b6c,
    this_ptr=0x0, return_value_used=1) at pdf.c:2491
#4  0x81092e5 in execute (op_array=0x8181cbc) at ./zend_execute.c:1519
#5  0x80dce88 in zend_execute_scripts (type=8, file_count=3) at zend.c:729
#6  0x8060e91 in php_execute_script (primary_file=0xbffff534) at main.c:1221
#7  0x805f369 in main (argc=2, argv=0xbffff594) at cgi_main.c:738

This error occurs regardless of the imagetype used (gif, tiff).
The script runs with 4.0.3pl1 just fine...



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-28 11:14 UTC]
Dup of 8394
 [2001-01-03 13:17 UTC]
This is fixed in CVS now.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 12 22:01:29 2024 UTC