OSDN Git Service

mmst: fix reading uninitialized data for ping packets.
authorRonald S. Bultje <rsbultje@gmail.com>
Mon, 14 Feb 2011 14:55:14 +0000 (09:55 -0500)
committerRonald S. Bultje <rsbultje@gmail.com>
Mon, 14 Feb 2011 14:55:14 +0000 (09:55 -0500)
Fixes errors after a few minutes (first ping) when playing back
mmst://wm.bbc.co.uk/wms/bbc7coyopa/bbc7_-_friday_0430.wma

libavformat/mmst.c

index ad87bbf..a2b55b5 100644 (file)
@@ -290,8 +290,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
                 return read_result < 0 ? read_result : AVERROR_IO;
             }
             packet_type= AV_RL16(mms->in_buffer+36);
-            hr = AV_RL32(mms->in_buffer + 40);
-            if (hr) {
+            if (read_result >= 44 && (hr = AV_RL32(mms->in_buffer + 40))) {
                 av_log(NULL, AV_LOG_ERROR,
                        "Server sent a message with packet type 0x%x and error status code 0x%08x\n", packet_type, hr);
                 return AVERROR_UNKNOWN;