hotfix for bug #186, drop connect args when not object. 2.0.4.
正在显示
3 个修改的文件
包含
16 行增加
和
3 行删除
| @@ -220,6 +220,7 @@ Supported operating systems and hardware: | @@ -220,6 +220,7 @@ Supported operating systems and hardware: | ||
| 220 | * 2013-10-17, Created.<br/> | 220 | * 2013-10-17, Created.<br/> |
| 221 | 221 | ||
| 222 | ## History | 222 | ## History |
| 223 | +* v2.0, 2014-10-24, fix [#186](https://github.com/winlinvip/simple-rtmp-server/issues/186), hotfix for bug #186, drop connect args when not object. 2.0.4. | ||
| 223 | * v2.0, 2014-10-24, rename wiki/xxx to wiki/v1_xxx. 2.0.3. | 224 | * v2.0, 2014-10-24, rename wiki/xxx to wiki/v1_xxx. 2.0.3. |
| 224 | * v2.0, 2014-10-19, fix [#184](https://github.com/winlinvip/simple-rtmp-server/issues/184), support AnnexB in RTMP body for HLS. 2.0.2 | 225 | * v2.0, 2014-10-19, fix [#184](https://github.com/winlinvip/simple-rtmp-server/issues/184), support AnnexB in RTMP body for HLS. 2.0.2 |
| 225 | * v2.0, 2014-10-18, remove supports for OSX(darwin). 2.0.1. | 226 | * v2.0, 2014-10-18, remove supports for OSX(darwin). 2.0.1. |
| @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 31 | // current release version | 31 | // current release version |
| 32 | #define VERSION_MAJOR "2" | 32 | #define VERSION_MAJOR "2" |
| 33 | #define VERSION_MINOR "0" | 33 | #define VERSION_MINOR "0" |
| 34 | -#define VERSION_REVISION "3" | 34 | +#define VERSION_REVISION "4" |
| 35 | #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION | 35 | #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION |
| 36 | // server info. | 36 | // server info. |
| 37 | #define RTMP_SIG_SRS_KEY "SRS" | 37 | #define RTMP_SIG_SRS_KEY "SRS" |
| @@ -1864,11 +1864,23 @@ int SrsConnectAppPacket::decode(SrsStream* stream) | @@ -1864,11 +1864,23 @@ int SrsConnectAppPacket::decode(SrsStream* stream) | ||
| 1864 | 1864 | ||
| 1865 | if (!stream->empty()) { | 1865 | if (!stream->empty()) { |
| 1866 | srs_freep(args); | 1866 | srs_freep(args); |
| 1867 | - args = SrsAmf0Any::object(); | ||
| 1868 | - if ((ret = args->read(stream)) != ERROR_SUCCESS) { | 1867 | + |
| 1868 | + // see: https://github.com/winlinvip/simple-rtmp-server/issues/186 | ||
| 1869 | + // the args maybe any amf0, for instance, a string. we should drop if not object. | ||
| 1870 | + SrsAmf0Any* any = NULL; | ||
| 1871 | + if ((ret = SrsAmf0Any::discovery(stream, &any)) != ERROR_SUCCESS) { | ||
| 1869 | srs_error("amf0 decode connect args failed. ret=%d", ret); | 1872 | srs_error("amf0 decode connect args failed. ret=%d", ret); |
| 1870 | return ret; | 1873 | return ret; |
| 1871 | } | 1874 | } |
| 1875 | + srs_assert(any); | ||
| 1876 | + | ||
| 1877 | + // drop when not an AMF0 object. | ||
| 1878 | + if (!any->is_object()) { | ||
| 1879 | + srs_warn("drop the args, see: '4.1.1. connect', marker=%#x", any->marker); | ||
| 1880 | + srs_freep(any); | ||
| 1881 | + } else { | ||
| 1882 | + args = any->to_object(); | ||
| 1883 | + } | ||
| 1872 | } | 1884 | } |
| 1873 | 1885 | ||
| 1874 | srs_info("amf0 decode connect packet success"); | 1886 | srs_info("amf0 decode connect packet success"); |
-
请 注册 或 登录 后发表评论