From e7d84156568712e32227e84afc6c0244784c169c Mon Sep 17 00:00:00 2001 From: Mats Peterson Date: Wed, 25 Feb 2015 21:14:33 +0100 Subject: [PATCH] avilib: read all of 'strf' even if biSize does not include it Fixes #1129. --- AUTHORS | 1 + ChangeLog | 4 ++++ lib/avilib-0.6.10/avilib.c | 18 +++++++++--------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/AUTHORS b/AUTHORS index c80edb4bb..b80a408aa 100644 --- a/AUTHORS +++ b/AUTHORS @@ -170,6 +170,7 @@ Peterson, Mats * bug fix for the number of bits/pixel in mkvextract for AVI files * bug fix for writing correct values in the ckSize of 'strf' chunks in mkvextract for AVI files + * bug fix for reading all of the private data in the 'strf' chunk Pettenò, Diego * Support for liblzo2 diff --git a/ChangeLog b/ChangeLog index e30021beb..98e86358e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2015-02-25 Mats Peterson + * mkvmerge: bug fix: Fixed reading all of the private codec data + in AVIs from the 'strf' chunk for codecs that don't set biSize to + include that data. Fixes #1129. + * mkvextract: bug fix: Fixed writing AVIs with ckSize fields that were too large. Fixes #1128. diff --git a/lib/avilib-0.6.10/avilib.c b/lib/avilib-0.6.10/avilib.c index 64b4cd7a6..1ebf2e201 100644 --- a/lib/avilib-0.6.10/avilib.c +++ b/lib/avilib-0.6.10/avilib.c @@ -2445,15 +2445,15 @@ int avi_parse_input_file(avi_t *AVI, int getIndex) i += 8; if(lasttag == 1) { - alBITMAPINFOHEADER bih; - - memcpy(&bih, hdrl_data + i, sizeof(alBITMAPINFOHEADER)); - AVI->bitmap_info_header = (alBITMAPINFOHEADER *) - malloc(str2ulong((unsigned char *)&bih.bi_size)); - if (AVI->bitmap_info_header != NULL) - memcpy(AVI->bitmap_info_header, hdrl_data + i, - str2ulong((unsigned char *)&bih.bi_size)); - + uint32_t ck_size = str2ulong(hdrl_data + i - 4); + uint32_t bih_size = str2ulong(hdrl_data + i); + uint32_t bi_size = bih_size > 40 ? bih_size : ck_size; + AVI->bitmap_info_header = (alBITMAPINFOHEADER *)malloc(bi_size); + if (AVI->bitmap_info_header != NULL) { + memcpy(AVI->bitmap_info_header, hdrl_data + i, bi_size); + long2str(&AVI->bitmap_info_header->bi_size, bi_size); + } + AVI->width = str2ulong(hdrl_data+i+4); AVI->height = str2ulong(hdrl_data+i+8); vids_strf_seen = 1;