From 49ea937be319bc66064b3723be494424942f0e9e Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 6 Apr 2016 18:43:29 +0200 Subject: [PATCH] Added patches to fix multiple minor issues in Wines windowscodecs implementation. --- patches/patchinstall.sh | 20 +++++++++++++- ...ndowscodecs-Fix-a-copy-paste-mistake.patch | 25 ++++++++++++++++++ ...locate-correct-amount-of-memory-for-.patch | 26 +++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 patches/windowscodecs-PNG_Fixes/0001-windowscodecs-Fix-a-copy-paste-mistake.patch create mode 100644 patches/windowscodecs-PNG_Fixes/0002-windowscodecs-Allocate-correct-amount-of-memory-for-.patch diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 84fd25b9..e71afff3 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "be91fcd879a1de768a57b4a06be470c10313b08d" + echo "dad56c7dc6ed0421e282e97f196bd195749d12ff" } # Show version information @@ -349,6 +349,7 @@ patch_enable_all () enable_widl_SLTG_Typelib_Support="$1" enable_windowscodecs_32bppGrayFloat="$1" enable_windowscodecs_IMILBitmapSource="$1" + enable_windowscodecs_PNG_Fixes="$1" enable_windowscodecs_WICCreateBitmapFromSection="$1" enable_wine_inf_Directory_ContextMenuHandlers="$1" enable_wine_inf_Dummy_CA_Certificate="$1" @@ -1224,6 +1225,9 @@ patch_enable () windowscodecs-IMILBitmapSource) enable_windowscodecs_IMILBitmapSource="$2" ;; + windowscodecs-PNG_Fixes) + enable_windowscodecs_PNG_Fixes="$2" + ;; windowscodecs-WICCreateBitmapFromSection) enable_windowscodecs_WICCreateBitmapFromSection="$2" ;; @@ -7109,6 +7113,20 @@ if test "$enable_windowscodecs_IMILBitmapSource" -eq 1; then ) >> "$patchlist" fi +# Patchset windowscodecs-PNG_Fixes +# | +# | Modified files: +# | * dlls/windowscodecs/pngformat.c +# | +if test "$enable_windowscodecs_PNG_Fixes" -eq 1; then + patch_apply windowscodecs-PNG_Fixes/0001-windowscodecs-Fix-a-copy-paste-mistake.patch + patch_apply windowscodecs-PNG_Fixes/0002-windowscodecs-Allocate-correct-amount-of-memory-for-.patch + ( + echo '+ { "Dmitry Timoshkov", "windowscodecs: Fix a copy/paste mistake.", 1 },'; + echo '+ { "Dmitry Timoshkov", "windowscodecs: Allocate correct amount of memory for PNG image data.", 1 },'; + ) >> "$patchlist" +fi + # Patchset windowscodecs-WICCreateBitmapFromSection # | # | This patchset fixes the following Wine bugs: diff --git a/patches/windowscodecs-PNG_Fixes/0001-windowscodecs-Fix-a-copy-paste-mistake.patch b/patches/windowscodecs-PNG_Fixes/0001-windowscodecs-Fix-a-copy-paste-mistake.patch new file mode 100644 index 00000000..09367626 --- /dev/null +++ b/patches/windowscodecs-PNG_Fixes/0001-windowscodecs-Fix-a-copy-paste-mistake.patch @@ -0,0 +1,25 @@ +From 976652bfa10c79b935b7061243b1561d6dc0e605 Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Wed, 6 Apr 2016 17:50:48 +0800 +Subject: windowscodecs: Fix a copy/paste mistake. + +--- + dlls/windowscodecs/pngformat.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c +index 4f5cb94..cd9165b 100644 +--- a/dlls/windowscodecs/pngformat.c ++++ b/dlls/windowscodecs/pngformat.c +@@ -532,7 +532,7 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p + } + + This->end_info = ppng_create_info_struct(This->png_ptr); +- if (!This->info_ptr) ++ if (!This->end_info) + { + ppng_destroy_read_struct(&This->png_ptr, &This->info_ptr, NULL); + This->png_ptr = NULL; +-- +2.7.1 + diff --git a/patches/windowscodecs-PNG_Fixes/0002-windowscodecs-Allocate-correct-amount-of-memory-for-.patch b/patches/windowscodecs-PNG_Fixes/0002-windowscodecs-Allocate-correct-amount-of-memory-for-.patch new file mode 100644 index 00000000..941a50b7 --- /dev/null +++ b/patches/windowscodecs-PNG_Fixes/0002-windowscodecs-Allocate-correct-amount-of-memory-for-.patch @@ -0,0 +1,26 @@ +From 88fdb199c976ff130003f9582e1a2c3662c700ad Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Wed, 6 Apr 2016 11:52:08 +0800 +Subject: windowscodecs: Allocate correct amount of memory for PNG image data. + +Currently the memory being allocated 8 times exceeds the image size. +--- + dlls/windowscodecs/pngformat.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c +index cd9165b..3eb4d0e 100644 +--- a/dlls/windowscodecs/pngformat.c ++++ b/dlls/windowscodecs/pngformat.c +@@ -664,7 +664,7 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p + /* read the image data */ + This->width = ppng_get_image_width(This->png_ptr, This->info_ptr); + This->height = ppng_get_image_height(This->png_ptr, This->info_ptr); +- This->stride = This->width * This->bpp; ++ This->stride = (This->width * This->bpp + 7) / 8; + image_size = This->stride * This->height; + + This->image_bits = HeapAlloc(GetProcessHeap(), 0, image_size); +-- +2.7.1 +