Hi,

i found that some software sends empty fmtp media attribute.
like: "a=ftmp:0\r\n" ("\r\n" immediatly follows after payload id)

in this case sdp parser throws exception and this exception destroys
AmSession leg

point of failure is here:
<pre>
core/AmSdp.cpp:
966 static void parse_sdp_attr(AmSdp* sdp_msg, char* s)
{
...
1102       case FORMAT_PARAM:
1103         {
1104           line_end--;
1105           while (is_wsp(*line_end))
1106             line_end--;
1107
1108           params = string(attr_line, line_end-attr_line+1); // <--
(line_end-attr_line+1) will be -1 for the "a=ftmp:0\r\n" as source data
1109           parsing = 0;
1110         }
1111         break;
...
}
</pre>

thus this code will throw exception in string() constructor

i simply patched code for this certain case:
<pre>
-         params = string(attr_line, line_end-attr_line+1);
+         if(attr_line >= line_end){
+               DBG("empty param for fmtp. ignore it");
+         } else {
+               params = string(attr_line, line_end-attr_line+1);
+         }
</pre>

but it's seems wrong to destroy entire leg due to sdp parsing error.
should be added checks for other params and/or catch for parsing
exceptions to respond with smth like 488 instead of 481

-- 
Best Regards
Michael Furmur

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to