From a9f692323e597324e6f01263c12b6f4290d5b56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Wed, 27 Mar 2019 02:14:37 +0100 Subject: [PATCH 8/8] C89 fixes for Haiku --- src/mms-common-funcs.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mms-common-funcs.h b/src/mms-common-funcs.h index 9e3c21d..f273756 100644 --- a/src/mms-common-funcs.h +++ b/src/mms-common-funcs.h @@ -205,12 +205,14 @@ static void interp_asf_header(TYPE *this) case GUID_ASF_HEADER_EXTENSION: { + int size; + int j = 24 + 18 + 4; + int l; + if ((24 + 18 + 4) > length) break; - int size = LE_32(this->asf_header + i + 24 + 18); - int j = 24 + 18 + 4; - int l; + size = LE_32(this->asf_header + i + 24 + 18); lprintf("Extension header data size: %d\n", size); while ((j + 24) <= length) { @@ -249,16 +251,18 @@ static void interp_asf_header(TYPE *this) // Loop through the number of extension system info for (x = 0; x < ext_count && (ext_j + 22) <= l; x++) { + int len; ext_j += 18; - int len = LE_16(this->asf_header + i + j + ext_j); + len = LE_16(this->asf_header + i + j + ext_j); ext_j += 4 + len; } lprintf("ext_j: %d\n", ext_j); // Finally, we arrive at the interesting point: The optional Stream Property Object if ((ext_j + 24) <= l) { + int len; guid = get_guid(this->asf_header, i + j + ext_j); - int len = LE_64(this->asf_header + i + j + ext_j + 16); + len = LE_64(this->asf_header + i + j + ext_j + 16); if (guid == GUID_ASF_STREAM_PROPERTIES && (ext_j + len) <= l) { interp_stream_properties(this, i + j + ext_j + 24); -- 2.39.2