midgardproject / midgard-php5

PHP5 API for Midgard persistent storage framework
http://www.midgard-project.org/api-docs/midgard/php/ratatoskr/
GNU Lesser General Public License v2.1
9 stars 2 forks source link

midgard_blob::read_content() segfaults PHP #68

Closed feri closed 12 years ago

feri commented 13 years ago

Environment: Debian unstable Midgard version: 10.05.6-1 (packages installed from OBS a week ago approx.)

I have an attachment object (midgard_attachment). Trying to get the corresponding blob to overwrite its content:

$blob = new midgard_blob($attachment);
$handler = $blob->get_handler('wb');
$content = $blob->read_content();

I get the following error:

Warning: Failed to get blob-contents: Critical internal error.   in /home/sopi/work/midgard2/com_meego_obsconnector/api/OBSFetcher.php on line 596

dmesg shows this:

[82747.670277] php[10817]: segfault at 8 ip 00007f2cfc18e470 sp 00007ffff87003d0 error 4 in libmidgard2.so.2010.5.0[7f2cfc13f000+88000]
feri commented 13 years ago

Note, that the 'w' flag in PHP will truncate the file. So read_content() segfaults only if the file has no content.

piotras commented 12 years ago

Fixed with midgard2-core commit https://github.com/midgardproject/midgard-core/commit/515f308af0133092a610b075e631c18befd6a889