Commit 0f3fc06b authored by Gábor Szalai's avatar Gábor Szalai

Bug 572603 Raw decoder bug, record of

If the record of decoder fails to decode the fixed number of elements, the contents were not
restored. The half decoded elements were not withdrawn.

Change-Id: I34ffbff178565ceefb628cbe77cf7dbac7cb1781
Signed-off-by: Gábor Szalai's avatarGabor Szalai <gabor.szalai@ericsson.com>
parent cbe61f0a
......@@ -976,10 +976,19 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output)
" if(p_td.raw->fieldlength || sel_field!=-1){\n"
" int a=0;\n"
" if(sel_field==-1) sel_field=p_td.raw->fieldlength;\n"
" start_of_field=p_buf.get_pos_bit();\n"
" for(a=0;a<sel_field;a++){\n"
" decoded_field_length=(*this)[a+start_field].RAW_decode(*p_td.oftype_descr,"
"p_buf,limit,top_bit_ord,TRUE);\n"
" if(decoded_field_length < 0) return decoded_field_length;\n"
" if(decoded_field_length < 0){\n"
" while(a>=0){\n"
" delete &(*this)[a+start_field];\n"
" a--;\n"
" val_ptr->n_elements--;\n"
" }\n"
" p_buf.set_pos_bit(start_of_field);\n"
" return decoded_field_length;\n"
" }\n"
" decoded_length+=decoded_field_length;\n"
" limit-=decoded_field_length;\n"
" }\n"
......@@ -2517,10 +2526,19 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct
" if(p_td.raw->fieldlength || sel_field!=-1){\n"
" int a=0;\n"
" if(sel_field==-1) sel_field=p_td.raw->fieldlength;\n"
" start_of_field=p_buf.get_pos_bit();\n"
" for(a=0;a<sel_field;a++){\n"
" decoded_field_length=(*this)[a+start_field].RAW_decode(*p_td.oftype_descr,"
"p_buf,limit,top_bit_ord,TRUE);\n"
" if(decoded_field_length < 0) return decoded_field_length;\n"
" if(decoded_field_length < 0){\n"
" while(a>=0){\n"
/*" delete &(*this)[a+start_field];\n"*/
" a--;\n"
" n_elements--;\n"
" }\n"
" p_buf.set_pos_bit(start_of_field);\n"
" return decoded_field_length;\n"
" }\n"
" decoded_length+=decoded_field_length;\n"
" limit-=decoded_field_length;\n"
" }\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment