Wez, I think we need to pass a real FILE * into the ming stuff. Take a
look at this segfault:
(gdb) run ming.php
Starting program: /usr/local/bin/php ming.php
FWS%xe HdC
Program received signal SIGSEGV, Segmentation fault.
0x403da4d4 in free () from /lib/libc.so.6
(gdb) bt
#0 0x403da4d4 in free () from /lib/libc.so.6
#1 0x403cffe8 in _IO_free_wbackup_area_internal () from /lib/libc.so.6
#2 0x403cdee0 in _IO_seekoff_internal () from /lib/libc.so.6
#3 0x403d269a in fseek () from /lib/libc.so.6
#4 0x40506d82 in SWFInput_file_seek (input=0x8321ae0, offset=0, whence=0) at
input.c:93
#5 0x40506c9e in SWFInput_seek (input=0x8321ae0, offset=0, whence=0) at input.c:52
#6 0x40506d31 in SWFInput_rewind (input=0x8321ae0) at input.c:75
#7 0x40507545 in methodWriteJpegFile (input=0x8321ae0, method=0x4001d610
<phpByteOutputMethod>, data=0x0)
at jpeg.c:87
#8 0x4050776d in writeSWFJpegBitmapToMethod (block=0x8321b58, method=0x4001d610
<phpByteOutputMethod>, data=0x0)
at jpeg.c:181
#9 0x40504451 in writeSWFBlockToMethod (block=0x8321b58, method=0x4001d610
<phpByteOutputMethod>, data=0x0)
at block.c:87
#10 0x404f2ab8 in SWFBlockList_writeBlocksToMethod (list=0x8314480, method=0x4001d610
<phpByteOutputMethod>,
data=0x0) at blocklist.c:78
#11 0x404f1ed2 in SWFMovie_output (movie=0x832cfd0, method=0x4001d610
<phpByteOutputMethod>, data=0x0)
at movie.c:262
#12 0x4001d681 in zif_swfmovie_output (ht=0, return_value=0x832da2c,
this_ptr=0x83228d4, return_value_used=0)
at /home/rasmus/php4/ext/ming/ming.c:1432
#13 0x081d8807 in execute (op_array=0x8321104) at
/home/rasmus/php4/Zend/zend_execute.c:1597
#14 0x081c698c in zend_execute_scripts (type=8, retval=0x0, file_count=3) at
/home/rasmus/php4/Zend/zend.c:839
#15 0x0818f622 in php_execute_script (primary_file=0xbffff880) at
/home/rasmus/php4/main/main.c:1542
#16 0x081de9d6 in main (argc=2, argv=0xbffff924) at
/home/rasmus/php4/sapi/cli/php_cli.c:695
#17 0x4037d1c4 in __libc_start_main () from /lib/libc.so.6
(gdb) up
#1 0x403cffe8 in _IO_free_wbackup_area_internal () from /lib/libc.so.6
(gdb) up
#2 0x403cdee0 in _IO_seekoff_internal () from /lib/libc.so.6
(gdb) up
#3 0x403d269a in fseek () from /lib/libc.so.6
(gdb) up
#4 0x40506d82 in SWFInput_file_seek (input=0x8321ae0, offset=0, whence=0)
at input.c:93
93 if(fseek((FILE *)input->data, offset, whence) == -1)
(gdb) p *(FILE *)input->data
$3 = {_flags = 1930623196, _IO_read_ptr = 0x82308e0
"/home/rasmus/php4/Zend/zend_API.c",
_IO_read_end = 0x255 <Address 0x255 out of bounds>, _IO_read_base = 0x0,
_IO_write_base = 0x82308e0 "/home/rasmus/php4/Zend/zend_API.c",
_IO_write_ptr = 0x249 <Address 0x249 out of bounds>, _IO_write_end = 0x8315030
"\022s\017#\b\006\001",
_IO_buf_base = 0x8314380 "\022s\017#\b", _IO_buf_end = 0x2c <Address 0x2c out of
bounds>,
_IO_save_base = 0x8 <Address 0x8 out of bounds>, _IO_backup_base = 0x7 <Address 0x7
out of bounds>,
_IO_save_end = 0x0, _markers = 0x0, _chain = 0x0, _fileno = 0, _blksize = 0,
_old_offset = 137446308,
_cur_column = 20156, _vtable_offset = 28 '\034', _shortbuf = "\b", _lock =
0x5a010000,
_offset = 3066894738570346496, __pad1 = 0x0, __pad2 = 0x83143d0, _mode = 81,
_unused2 = "\022s\017#\b", '\0' <repeats 15 times>, " C1\bC1\b ", '\0' <repeats 18
times>}
(gdb) p *(php_stream*)input->data
$7 = {ops = 0x7312f8dc, abstract = 0x82308e0, filterhead = 0x255, filtertail = 0x0,
wrapper = 0x82308e0,
wrapperthis = 0x249, wrapperdata = 0x8315030, fgetss_state = 137446272,
is_persistent = 44,
mode = "\b\0\0\0\a\0\0\0\0\0\0\0\0\0\0", rsrc_id = 0, in_free = 0, fclose_stdiocast
= 0, stdiocast = 0x83143a4,
__exposed = 136072892, __orig_path = 0x5a010000 "", context = 0x0, flags =
714067076, position = 0,
readbuf = 0x83143d0 "\022s\b#\bU\002", readbuflen = 81, readpos = 1930623196,
writepos = 136515520,
chunk_size = 178, eof = 0}
It is casting it to a FILE * and trying to do an fseek, so passing it a
php_stream is bad news here.
-Rasmus
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php