1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

hotfix for bug #186, drop connect args when not object. 2.0.4.

This commit is contained in:
winlin 2014-10-24 10:35:40 +08:00
parent a169262099
commit 1bfc238fec
3 changed files with 16 additions and 3 deletions

View file

@ -1864,11 +1864,23 @@ int SrsConnectAppPacket::decode(SrsStream* stream)
if (!stream->empty()) {
srs_freep(args);
args = SrsAmf0Any::object();
if ((ret = args->read(stream)) != ERROR_SUCCESS) {
// see: https://github.com/winlinvip/simple-rtmp-server/issues/186
// the args maybe any amf0, for instance, a string. we should drop if not object.
SrsAmf0Any* any = NULL;
if ((ret = SrsAmf0Any::discovery(stream, &any)) != ERROR_SUCCESS) {
srs_error("amf0 decode connect args failed. ret=%d", ret);
return ret;
}
srs_assert(any);
// drop when not an AMF0 object.
if (!any->is_object()) {
srs_warn("drop the args, see: '4.1.1. connect', marker=%#x", any->marker);
srs_freep(any);
} else {
args = any->to_object();
}
}
srs_info("amf0 decode connect packet success");