php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11242 Apache explodes if I leave out cpdf_page_init()
Submitted: 2001-06-01 14:18 UTC Modified: 2002-04-09 17:31 UTC
From: peter at helpnet dot com dot au Assigned:
Status: Not a bug Package: ClibPDF related
PHP Version: 4.0.5 OS: NT 4.0 SP6
Private report: No CVE-ID: None
 [2001-06-01 14:18 UTC] peter at helpnet dot com dot au
cpdf_page_init() starts a new page, and seems a trivial function, but, if I leave it out, Apache explodes. Perhaps there should be an error message instead.

$doc = cpdf_open(0))
cpdf_page_init($doc, 1, 0, 200, 300);
cpdf_add_outline($doc, 0, 0, 0, 1, "Page 1");
cpdf_begin_text($doc);
cpdf_set_font ($doc, "Times-Roman", 10, "NULL");
cpdf_set_text_rendering($doc, 1);
cpdf_text($doc, "test text", 5, 5);
cpdf_end_text($doc);
cpdf_finalize($doc);
cpdf_close($doc);

The Apache error is the general exception 0x00000005 message that seems to happen for a few types of errors. Apache is 1.13.20 and running as a service with PHP as ISAPI. There are no errors in the Apache or PHP logs.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-09 17:31 UTC] jimw@php.net
this bug appears to be inside clibpdf. you should report it to fastio.com. (they appear to be dereferencing a pointer before checking that it is valid.)

the backtrace i get:

Program received signal SIGSEGV, Segmentation fault.
0x08169159 in cpdf_writeMemoryStream (memStream=0x0, data=0x8201b50 "\nBT\n", 
    len=4) at cpdfMemBuf.c:105
105         if(memStream->magic_number != MEMSTREAM_MAGIC)
(gdb) bt
#0  0x08169159 in cpdf_writeMemoryStream (memStream=0x0, 
    data=0x8201b50 "\nBT\n", len=4) at cpdfMemBuf.c:105
#1  0x0815f6ca in cpdf_beginText (pdf=0x81fcec0, clipmode=0) at cpdfText.c:63
#2  0x08065326 in zif_cpdf_begin_text (ht=1, return_value=0x82147b4, 
    this_ptr=0x0, return_value_used=0) at /home/jimw/php4/ext/cpdf/cpdf.c:632
#3  0x0815113a in execute (op_array=0x81fce0c)
    at /home/jimw/php4/Zend/zend_execute.c:1598
#4  0x08140cb9 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /home/jimw/php4/Zend/zend.c:810
#5  0x08115001 in php_execute_script (primary_file=0xbffffc04)
    at /home/jimw/php4/main/main.c:1409
#6  0x08156951 in main (argc=2, argv=0xbffffc94)
    at /home/jimw/php4/sapi/cgi/cgi_main.c:1020

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Jun 24 17:01:25 2019 UTC