!30 [sync] PR-29: Initialize rows using heap for large images

From: @openeuler-sync-bot 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
This commit is contained in:
openeuler-ci-bot 2023-11-29 08:07:38 +00:00 committed by Gitee
commit c50adf2b6f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 31 additions and 2 deletions

View File

@ -0,0 +1,25 @@
From 26af56ed7ffbec97640c52145137a5f41ec8213b Mon Sep 17 00:00:00 2001
From: Joshua Sager <joshua.sager@shopify.com>
Date: Mon, 13 Sep 2021 17:50:33 -0400
Subject: [PATCH] Initialize rows using heap for large images
---
libimagequant.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libimagequant.c b/libimagequant.c
index 5507614..18b5ef6 100644
--- a/libimagequant.c
+++ b/libimagequant.c
@@ -2100,7 +2100,7 @@ LIQ_EXPORT LIQ_NONNULL liq_error liq_write_remapped_image(liq_result *result, li
return LIQ_BUFFER_TOO_SMALL;
}
- LIQ_ARRAY(unsigned char *, rows, input_image->height);
+ unsigned char **rows = malloc(input_image->height * sizeof(unsigned char *));
unsigned char *buffer_bytes = buffer;
for(unsigned int i=0; i < input_image->height; i++) {
rows[i] = &buffer_bytes[input_image->width * i];
--
2.42.0.windows.2

View File

@ -1,6 +1,6 @@
Name: libimagequant
Version: 2.15.1
Release: 3
Release: 4
Summary: Palette quantization library
License: GPLv3+ and MIT
URL: https://github.com/ImageOptim/libimagequant
@ -8,7 +8,8 @@ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch0000: libimagequant_solibperm.patch
Patch0001: 0001-de-recurse-hist_item_sort_halfvar.patch
# https://github.com/ImageOptim/libimagequant/commit/26af56ed7ffbec97640c52145137a5f41ec8213b
Patch0002: Initialize-rows-using-heap-for-large-images.patch
BuildRequires: gcc
@ -49,6 +50,9 @@ rm -f %{buildroot}%{_libdir}/%{name}.a
%{_libdir}/pkgconfig/imagequant.pc
%changelog
* Tue Nov 28 2023 yaoxin <yao_xin001@hoperun.com> - 2.15.1-4
- Initialize rows using heap for large images
* Mon Oct 23 2023 liubo <liubo1@xfusion.com> - 2.15.1-3
- de-recurse hist_item_sort_halfvar()