From c466779d901c4fde82dd362a3cf3d5cf43c751b3 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 12 Dec 2014 05:53:08 +0100 Subject: [PATCH] Added patch to reallocate buffer when adding records to AVI files. --- README.md | 3 +- debian/changelog | 1 + patches/Makefile | 16 +++++++ ...eallocate-buffer-when-adding-records.patch | 43 +++++++++++++++++++ patches/avifil32-Realloc_Records/definition | 1 + 5 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 patches/avifil32-Realloc_Records/0001-avifil32-Reallocate-buffer-when-adding-records.patch create mode 100644 patches/avifil32-Realloc_Records/definition diff --git a/README.md b/README.md index 977eb22f..86b16d8a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Wine. All those differences are also documented on the Included bug fixes and improvements =================================== -**Bugfixes and features included in the next upcoming release [10]:** +**Bugfixes and features included in the next upcoming release [11]:** * Add support for GetPropValue to PulseAudio backend * Fix condition mask handling in RtlVerifyVersionInfo ([Wine Bug #36143](https://bugs.winehq.org/show_bug.cgi?id=36143)) @@ -45,6 +45,7 @@ Included bug fixes and improvements * Fix return value of ScrollWindowEx for invisible windows ([Wine Bug #37706](https://bugs.winehq.org/show_bug.cgi?id=37706)) * Ignore unsupported flags for CoInternetSetFeatureEnabled ([Wine Bug #35197](https://bugs.winehq.org/show_bug.cgi?id=35197)) * Provide named entry point shell32.SHILCreateFromPath for vista apps ([Wine Bug #37265](https://bugs.winehq.org/show_bug.cgi?id=37265)) +* Reallocate buffer when adding records to AVI files ([Wine Bug #5137](https://bugs.winehq.org/show_bug.cgi?id=5137)) * Set last error when GetRawInputDeviceList fails ([Wine Bug #37667](https://bugs.winehq.org/show_bug.cgi?id=37667)) * Support for StrCatChainW * Support for combase HSTRING objects diff --git a/debian/changelog b/debian/changelog index 8ebbe046..160ca42d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,7 @@ wine-compholio (1.7.33) UNRELEASED; urgency=low * Added patch to fix return value of ScrollWindowEx for invisible windows. * Added patch to ignore unsupported flags for CoInternetSetFeatureEnabled. * Added patch to provide named entry point shell32.SHILCreateFromPath for vista apps. + * Added patch to reallocate buffer when adding records to AVI files. * Removed patch to fix copy and paste errors in ws2_32 tests (accepted upstream). * Removed patch to fix ordering of IP addresses by metric if two addresses have the same metric (accepted upstream). * Removed patch to reset data->pWintrustData->u.pFile->hFile after closing handle (accepted upstream). diff --git a/patches/Makefile b/patches/Makefile index a8cdc32b..dd23270c 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -24,6 +24,7 @@ PATCHLIST := \ Pipelight.ok \ Staging.ok \ atl-IOCS_Property.ok \ + avifil32-Realloc_Records.ok \ combase-HSTRING.ok \ comctl32-LoadIconMetric.ok \ configure-Absolute_RPATH.ok \ @@ -277,6 +278,21 @@ atl-IOCS_Property.ok: echo '+ { "Qian Hong", "atl: Don'\''t use GWLP_USERDATA to store IOCS to avoid conflict with Apps.", 1 },'; \ ) > atl-IOCS_Property.ok +# Patchset avifil32-Realloc_Records +# | +# | This patchset fixes the following Wine bugs: +# | * [#5137] Reallocate buffer when adding records to AVI files +# | +# | Modified files: +# | * dlls/avifil32/avifile.c +# | +.INTERMEDIATE: avifil32-Realloc_Records.ok +avifil32-Realloc_Records.ok: + $(call APPLY_FILE,avifil32-Realloc_Records/0001-avifil32-Reallocate-buffer-when-adding-records.patch) + @( \ + echo '+ { "Sebastian Lackner", "avifil32: Reallocate buffer when adding records.", 1 },'; \ + ) > avifil32-Realloc_Records.ok + # Patchset combase-HSTRING # | # | Modified files: diff --git a/patches/avifil32-Realloc_Records/0001-avifil32-Reallocate-buffer-when-adding-records.patch b/patches/avifil32-Realloc_Records/0001-avifil32-Reallocate-buffer-when-adding-records.patch new file mode 100644 index 00000000..a4212ac2 --- /dev/null +++ b/patches/avifil32-Realloc_Records/0001-avifil32-Reallocate-buffer-when-adding-records.patch @@ -0,0 +1,43 @@ +From a7766bfbb41580091192539432c9372ceaf41c18 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Fri, 12 Dec 2014 05:48:59 +0100 +Subject: avifil32: Reallocate buffer when adding records. + +Based on a patch by Bruno Jesus. +--- + dlls/avifil32/avifile.c | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c +index af0315d..c7779c5 100644 +--- a/dlls/avifil32/avifile.c ++++ b/dlls/avifil32/avifile.c +@@ -1424,11 +1424,20 @@ static HRESULT AVIFILE_AddRecord(IAVIFileImpl *This) + /* pre-conditions */ + assert(This != NULL && This->ppStreams[0] != NULL); + +- if (This->idxRecords == NULL || This->cbIdxRecords == 0) { +- This->cbIdxRecords += 1024 * sizeof(AVIINDEXENTRY); +- This->idxRecords = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->cbIdxRecords); +- if (This->idxRecords == NULL) +- return AVIERR_MEMORY; ++ if (This->idxRecords == NULL || This->cbIdxRecords / sizeof(AVIINDEXENTRY) <= This->nIdxRecords) { ++ DWORD new_count = This->cbIdxRecords + 1024 * sizeof(AVIINDEXENTRY); ++ if (!This->idxRecords) ++ { ++ This->idxRecords = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, new_count); ++ if (!This->idxRecords) return AVIERR_MEMORY; ++ } ++ else ++ { ++ void *new_buffer = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->idxRecords, new_count); ++ if (!new_buffer) return AVIERR_MEMORY; ++ This->idxRecords = new_buffer; ++ } ++ This->cbIdxRecords = new_count; + } + + assert(This->nIdxRecords < This->cbIdxRecords/sizeof(AVIINDEXENTRY)); +-- +2.1.3 + diff --git a/patches/avifil32-Realloc_Records/definition b/patches/avifil32-Realloc_Records/definition new file mode 100644 index 00000000..2fbf672f --- /dev/null +++ b/patches/avifil32-Realloc_Records/definition @@ -0,0 +1 @@ +Fixes: [5137] Reallocate buffer when adding records to AVI files