Menu

#15 Segmentation Fault on $movie->getFrame(integer FrameNumer)

open
general (27)
5
2005-04-25
2005-04-25
Anonymous
No

Upon calling the $movie->getFrame method, the process
segfaults.

This applies for Apache as well as PHP CLI versions of
the script. This applies when loading the extension
from php.ini as well as loading the extension from a
script itself.
The bug was tested using .mpg, .mpeg and .avi files.
The used media files were usable from within ffmpeg
(succesfully converted an mpg to avi).

Other methods, such as $movie->getWidth(),
getDuration(), getHeight() and getWidth() work just fine.

Also verified using the test_ffmpeg.php from the
testsuite. This outputs everything okay, but also
segfaults the second it calls getFrame().

Versions:

Debian Linux 3.0
Linux s04 2.4.29-grsec

ffmpeg version 0.4.9-pre1, build 4718, Copyright (c)
2000-2004 Fabrice Bellard
built on Apr 25 2005 12:01:38, gcc: 2.95.4 20011002
(Debian prerelease)

ffmpeg-php-0.4.3

PHP Api Version: 20020918
Zend Module Api No: 20020429
Zend Extension Api No: 20021010

PHP 4.3.11-dotdeb

Code:
<?php
$extension = "ffmpeg";
$extension_soname = $extension . "." .
PHP_SHLIB_SUFFIX;
$extension_fullname = PHP_EXTENSION_DIR . "/" .
$extension_soname;

// load extension
if(!extension_loaded($extension))
{
dl($extension_soname);
}

$movie = new ffmpeg_movie("test.avi");
$frame = $movie->getFrame(1);
?>

strace output:

open("test.avi", O_RDONLY|O_LARGEFILE) = 3
brk(0x8433000) = 0x8433000
read(3, "RIFFX\304(\0AVI
LIST\200\"\0\0hdrlavih8\0\0\0"..., 32768) = 32768
_llseek(3, 2639448, [2639448], SEEK_SET) = 0
read(3, "idx1\0~\0\00001wb\20\0\0\0\4\0\0\0
\1\0\00000dc\20\0\0"..., 32768) = 32264
brk(0x8434000) = 0x8434000
brk(0x8436000) = 0x8436000
brk(0x8438000) = 0x8438000
brk(0x843b000) = 0x843b000
_llseek(3, 8864, [8864], SEEK_SET) = 0
_llseek(3, 0, [8864], SEEK_CUR) = 0
_llseek(3, -1, [2671711], SEEK_END) = 0
_llseek(3, 8864, [8864], SEEK_SET) = 0
brk(0x843d000) = 0x843d000
brk(0x843e000) = 0x843e000
brk(0x843f000) = 0x843f000
brk(0x8440000) = 0x8440000
brk(0x8441000) = 0x8441000
...

...
brk(0x84b9000) = 0x84b9000
brk(0x84ba000) = 0x84ba000
brk(0x84bb000) = 0x84bb000
read(3, "01wb
\1\0\0\377\375H\304S4$236\234d\0\0\0\374\377\377\377"...,
32768) = 32768
brk(0x84bf000) = 0x84bf000
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++

Discussion

  • Nobody/Anonymous

    Logged In: NO

    try running with gdb and see if that gives a line number of
    the segfault.

    -Todd

     
  • Nobody/Anonymous

    Logged In: NO

    Hi,
    I had a similiar problem but on Windows plantform... I found
    that the libavcodec crash the program in the avcodec_open()
    function.
    I allways thought that the cause of this problem was the
    Windows plantform. Please, confirm if we have the same
    problem, although the environments are different.
    Diogo

     
  • Nobody/Anonymous

    Logged In: NO

    Hi,
    I had a similiar problem but on Windows plantform... I found
    that the libavcodec crash the program in the avcodec_open()
    function.
    I allways thought that the cause of this problem was the
    Windows plantform. Please, confirm if we have the same
    problem, although the environments are different.
    Diogo

     
  • Nobody/Anonymous

    Logged In: NO

    Try to link GD and ZLIB to PHP not as "shared libraries", but
    as "static": compile PHP with keys "--with-gd --with-zlib".

    I had similar problem on FreeBSD 5.3: all other ffmpeg-php
    functions work fine, but getFrame() doesn't work at all. And the
    only thing I have done: recompiled PHP with static GD and
    ZLIB.

    /Alexey

     
  • Nobody/Anonymous

    Logged In: NO

    Try to link GD and ZLIB to PHP not as "shared libraries", but
    as "static": compile PHP with keys "--with-gd --with-zlib".

    I had similar problem on FreeBSD 5.3: all other ffmpeg-php
    functions work fine, but getFrame() doesn't work at all. And the
    only thing I have done: recompiled PHP with static GD and
    ZLIB.

    /Alexey

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.