Menu

#14 segfault in audio/acodec/acodec.c

open
Bors
pymedia (8)
5
2007-02-24
2007-02-24
No

looks like a NULL pointer dereference in audio/acodec/acodec.

I can provide bad.mp3 if required.

backtrace

gdb python
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) set args dump_wav.py /mnt/windows2/Audio/bad.mp3
(gdb) r
Starting program: /usr/bin/python dump_wav.py /mnt/windows2/Audio/bad.mp3
[Thread debugging using libthread_db enabled]
[New Thread -1211943248 (LWP 8359)]
>>> [*]dumpWAV starting

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211943248 (LWP 8359)]
0xb7c96234 in free () from /lib/libc.so.6
(gdb) bt
#0 0xb7c96234 in free () from /lib/libc.so.6
#1 0xb78bf3d6 in av_free (ptr=0xb7508008) at audio/mem.c:155
#2 0xb78be014 in ACString_Del (str=0xb7c2e0e0) at audio/acodec/acodec.c:177
#3 0xb78be4e0 in AFrameClose (obj=0xb763e8e0) at audio/acodec/acodec.c:399
#4 0xb7e2c66e in PyEval_EvalFrame (f=0x805a63c) at Python/ceval.c:917
#5 0xb7e34182 in fast_function (func=0xb763a684, pp_stack=0xbfc5ef9c, n=1, na=1, nk=0) at Python/ceval.c:3651
#6 0xb7e33f8a in call_function (pp_stack=0xbfc5ef9c, oparg=1) at Python/ceval.c:3589
#7 0xb7e3044f in PyEval_EvalFrame (f=0x809cedc) at Python/ceval.c:2167
#8 0xb7e31ecb in PyEval_EvalCodeEx (co=0xb7bbea60, globals=0xb7c0c824, locals=0xb7c0c824, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0,
defcount=0, closure=0x0) at Python/ceval.c:2741
#9 0xb7e2bfe3 in PyEval_EvalCode (co=0xb7bbea60, globals=0xb7c0c824, locals=0xb7c0c824) at Python/ceval.c:484
#10 0xb7e60968 in run_node (n=0xb7bf3338, filename=0xbfc6106f "dump_wav.py", globals=0xb7c0c824, locals=0xb7c0c824, flags=0xbfc5f210)
at Python/pythonrun.c:1285
#11 0xb7e608c0 in run_err_node (n=0xb7bf3338, filename=0xbfc6106f "dump_wav.py", globals=0xb7c0c824, locals=0xb7c0c824, flags=0xbfc5f210)
at Python/pythonrun.c:1272
#12 0xb7e6085e in PyRun_FileExFlags (fp=0x804a008, filename=0xbfc6106f "dump_wav.py", start=257, globals=0xb7c0c824, locals=0xb7c0c824, closeit=1,
flags=0xbfc5f210) at Python/pythonrun.c:1263
#13 0xb7e5f42a in PyRun_SimpleFileExFlags (fp=0x804a008, filename=0xbfc6106f "dump_wav.py", closeit=1, flags=0xbfc5f210) at Python/pythonrun.c:869
#14 0xb7e5eb99 in PyRun_AnyFileExFlags (fp=0x804a008, filename=0xbfc6106f "dump_wav.py", closeit=1, flags=0xbfc5f210) at Python/pythonrun.c:673
#15 0xb7e694bd in Py_Main (argc=3, argv=0xbfc5f314) at Modules/main.c:493
#16 0x080486ba in main (argc=3, argv=0xbfc5f314) at Modules/python.c:23
(gdb)

dump_wav.py

#! /bin/env python
import sys
import pymedia.audio.acodec as acodec
import pymedia.muxer as muxer
import time, wave, string, os
import gc

global cnt
cnt=0
def dumpWAV( name ):
print ">>> [*]dumpWAV starting"
name1= str.split( name, '.' )
name2= string.join( name1[ : len( name1 )- 1 ] )
dm= muxer.Demuxer( name1[ -1 ].lower() )
dec= None
f= open( name, 'rb' )
snd= None
s= " "
while len( s ):
s= f.read( 20000 )
if len( s ):
frames= dm.parse( s )
for fr in frames:
global cnt
cnt += 1
if cnt < 1263:
continue
if dec== None:
dec= acodec.Decoder( dm.streams[ 0 ] )
r= dec.decode( fr[ 1 ] )
if r and r.data:
if snd== None:
snd= wave.open( name2+ '.wav', 'wb' )
snd.setparams( (r.channels, 2, r.sample_rate, 0, 'NONE','') )
#snd.writeframes( r.data )

print ">>> [*] dumpWAV done"
if __name__=="__main__":
gc.disable()
dumpWAV(sys.argv[1])

Discussion


Log in to post a comment.

MongoDB Logo MongoDB