limscoder / amfast

An Adobe AMF serialization and RPC implementation for Python, written as a C extension for speed.
MIT License
5 stars 6 forks source link

SIGSEGV when using encode_types (return from get_typed_val is NULL) #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Working on a reduction set

What version of the product are you using? On what operating system?

0.4.2 linux/stackless 2.6.4

Please provide any additional information below.

Program terminated with signal 11, Segmentation fault.
#0  type_list (class_def=<value optimized out>, mapper=<value optimized 
out>, name_list=0x1549f18, val_list=0x154be60, type=<value optimized 
out>) at amfast/ext_src/amf.c:101
101 amfast/ext_src/amf.c: No such file or directory.
    in amfast/ext_src/amf.c

#0  type_list (class_def=<value optimized out>, mapper=<value optimized 
out>, name_list=0x1549f18, val_list=0x154be60, type=<value optimized 
out>) at amfast/ext_src/amf.c:101
#1  0x00002ba2f5acaa8f in static_attr_vals_from_class_def 
(context=0x15473f0, class_def=0x154d250, value=<value optimized 
out>) at amfast/ext_src/encoder.c:1426
#2  0x00002ba2f5acd17e in encode_object_AMF3 (context=0x15473f0, 
value=0x14ee3d0) at amfast/ext_src/encoder.c:907
#3  0x00002ba2f5accc74 in serialize_object_AMF3 (context=0x15473f0, 
value=0x14ee3d0) at amfast/ext_src/encoder.c:863
#4  encode_AMF3 (context=0x15473f0, value=0x14ee3d0) at 
amfast/ext_src/encoder.c:1961
#5  0x00002ba2f5ace1b1 in write_object_AMF0 (context=<value 
optimized out>, value=0x14ee3d0) at amfast/ext_src/encoder.c:1493
#6  encode_AMF0 (context=<value optimized out>, value=0x14ee3d0) at 
amfast/ext_src/encoder.c:1899
#7  0x00002ba2f5acf6cc in py_encode (self=<value optimized out>, 
args=<value optimized out>, kwargs=<value optimized out>) at 
amfast/ext_src/encoder.c:1999
#8  0x00000000004a347c in call_function (f=0x1602aa0, 
throwflag=<value optimized out>, retval=<value optimized out>) at 
Python/ceval.c:4023
#9  PyEval_EvalFrame_value (f=0x1602aa0, throwflag=<value optimized 
out>, retval=<value optimized out>) at Python/ceval.c:2598

item = <value optimized out>
typed_item = 0x0
result = <value optimized out>
name = <value optimized out>
callable = 0x77c100
types = 0x15c6320
name_len = 4
val_len = <value optimized out>
i = 3

typed_item is NULL. relevant code:

amf.c:97-105 from trunk:

            PyObject *typed_item = get_typed_val(mapper, callable, item);
            Py_DECREF(callable);

            int result = PySequence_SetItem(val_list, i, lo);
            Py_DECREF(typed_item);
            if (result == -1) {
                Py_DECREF(types);
                return 0;
            }

... since get_typed_val() can return NULL in a number of error conditions, 
this needs to be checked before calling Py_DECREF. Could change this to 
Py_XDECREF...

Original issue reported on code.google.com by stuffonf...@gmail.com on 28 Jan 2010 at 9:15

GoogleCodeExporter commented 9 years ago
See 
http://github.com/stuffonfire/AmFast/commit/c349159540aee0d638b58abef20d1b8d
30dbdcd5

Original comment by stuffonf...@gmail.com on 28 Jan 2010 at 9:40

GoogleCodeExporter commented 9 years ago
Thanks for opening a ticket. Latest update to trunk should help.

Original comment by dthomp...@gmail.com on 28 Jan 2010 at 11:48

GoogleCodeExporter commented 9 years ago

Original comment by dthomp...@gmail.com on 8 Feb 2010 at 8:30