php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5244 seg fault in pg_loreadall()
Submitted: 2000-06-28 08:48 UTC Modified: 2000-06-28 09:28 UTC
From: graeme at inetix dot com dot au Assigned: jah (profile)
Status: Closed Package: PostgreSQL related
PHP Version: 4.0 Latest CVS (28/06/2000) OS: Linux i386 2.2.16
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: graeme at inetix dot com dot au
New email:
PHP Version: OS:

 

 [2000-06-28 08:48 UTC] graeme at inetix dot com dot au
This is my first time out with pg_lo* functions

configure line
./configure  --with-apache=/usr/src/inspire/apache_1.3.12 --enable-track-vars --enable-magic-quotes --with-pgsql --with-mysql=/usr/local/mysql --with-sybase=/opt/sybase

Relevant output:
checking for PostgresSQL support... yes
checking for PQcmdTuples in -lpq... yes
checking for PQoidValue in -lpq... no

Script (this is from an example. Also tried pg_loreadall() after sending image header but no go:
<?php
$fhandle = pg_loopen($db,$photo,"r");
$img1 = pg_loreadall($fhandle);
$size = pg_loread($fhandle);
header("Content-type: image/jpg");
header("Content-length: $size");
echo $img1;
?>

Output from a backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x80e1075 in zend_fetch_resource ()
(gdb) bt
#0  0x80e1075 in zend_fetch_resource ()
#1  0x809a09c in php_if_pg_loreadall ()
#2  0x810143c in execute ()
#3  0x807e7cb in php_execute_script ()
#4  0x80e7520 in apache_php_module_main ()
#5  0x807c5ab in send_php ()
#6  0x807c5ec in send_parsed_php ()
#7  0x810ab33 in ap_invoke_handler ()
#8  0x811e069 in ap_some_auth_required ()
#9  0x811e0cc in ap_process_request ()
#10 0x811596e in ap_child_terminate ()
#11 0x8115afc in ap_child_terminate ()
#12 0x8115c59 in ap_child_terminate ()
#13 0x8116286 in ap_child_terminate ()
#14 0x8116a13 in main ()
#15 0x401ca9cb in __libc_start_main (main=0x81166cc <main>, argc=2, 
    argv=0xbffffa54, init=0x8062ca4 <_init>, fini=0x814b3ac <_fini>, 
    rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffa4c)
    at ../sysdeps/generic/libc-start.c:92

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-28 09:06 UTC] jah at cvs dot php dot net
Please read the manual about use of functions pg_loread() and
pg_loreadall, your example is just clearly wrong. And you should call
header() before trying to dump data to the browser.

Anyway, it shouldn't segfault on you, so this maybe needs some fixing at
my part too. Hey, did you remember that everything related to large objects
with PostgreSQL must happen inside a transaction? And I don't see you
opening a connection to a database server in your script. Please send a
complete example.
 [2000-06-28 09:28 UTC] jah at cvs dot php dot net
Fixed in cvs.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 23:01:32 2024 UTC