Check if hcodec_id is set before using it. Occurs with e.g. RealVideo.

This commit is contained in:
Moritz Bunkus 2004-01-02 21:49:58 +00:00
parent d1896791cb
commit 905b53dc14
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2004-01-02 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Segfault when muxing some video formats due
to unchecked data (includes RealVideo).
2004-01-01 Moritz Bunkus <moritz@bunkus.org>
* Released v0.8.0.

View File

@ -73,7 +73,8 @@ void video_packetizer_c::set_headers() {
!strncasecmp(fourcc, "XVID", 4) ||
!strncasecmp(fourcc, "DX5", 3))
is_mpeg4 = true;
} else if (!strncmp(hcodec_id, MKV_V_MPEG4_SP, strlen(MKV_V_MPEG4_SP) - 2))
} else if ((hcodec_id != NULL) &&
!strncmp(hcodec_id, MKV_V_MPEG4_SP, strlen(MKV_V_MPEG4_SP) - 2))
is_mpeg4 = true;
if (codec_id != NULL)
@ -86,7 +87,7 @@ void video_packetizer_c::set_headers() {
} else
set_codec_id(MKV_V_MSCOMP);
if ((!is_mpeg4 || !hack_engaged(ENGAGE_NATIVE_BFRAMES)) &&
!strcmp(hcodec_id, MKV_V_MSCOMP) &&
(hcodec_id != NULL) && !strcmp(hcodec_id, MKV_V_MSCOMP) &&
(ti->private_data != NULL) &&
(ti->private_size >= sizeof(alBITMAPINFOHEADER)) &&
(ti->fourcc[0] != 0))