summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2012-07-25 20:51:11 +0200
committerMartin Storsjö <martin@martin.st>2012-07-25 23:57:01 +0300
commitabf77a247baa19357bbf41d6460d4f65a8ff07f2 (patch)
tree134abde5a8cdfdc0c3d201fd45bd671fc592eac4
parentbe8f949219c03e6bf93d8d563ef33b8ad4faa1e9 (diff)
rtmp: Return an error when the client bandwidth is incorrect
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/rtmpproto.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 5ac60d21a0..a2efe3882f 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -932,8 +932,16 @@ static int handle_client_bw(URLContext *s, RTMPPacket *pkt)
pkt->data_size);
return AVERROR_INVALIDDATA;
}
- av_log(s, AV_LOG_DEBUG, "Client bandwidth = %d\n", AV_RB32(pkt->data));
- rt->client_report_size = AV_RB32(pkt->data) >> 1;
+
+ rt->client_report_size = AV_RB32(pkt->data);
+ if (rt->client_report_size <= 0) {
+ av_log(s, AV_LOG_ERROR, "Incorrect client bandwidth %d\n",
+ rt->client_report_size);
+ return AVERROR_INVALIDDATA;
+
+ }
+ av_log(s, AV_LOG_DEBUG, "Client bandwidth = %d\n", rt->client_report_size);
+ rt->client_report_size >>= 1;
return 0;
}