Add patch for big-endian machines.
This commit is contained in:
parent
6058dd4c4f
commit
8119e30d26
|
@ -0,0 +1,35 @@
|
|||
From e90e9d982e344da89c1746606990df7709bb88df Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Wed, 2 Sep 2020 06:18:36 -0400
|
||||
Subject: [PATCH] Fix execute_session_scan_read on big endian machines.
|
||||
|
||||
The buffer contains an `int`, and `msg_out->raw.iov_len` is a `size_t`,
|
||||
which is twice the size on 64-bit machines. On big-endian machines, the
|
||||
4 bytes of the `int` will be put in the MSB, meaning `malloc` will be
|
||||
called with a really big number.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
.../libinsane/src/workarounds/dedicated_process/worker.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/subprojects/libinsane/src/workarounds/dedicated_process/worker.c b/subprojects/libinsane/src/workarounds/dedicated_process/worker.c
|
||||
index e6a84e3..732d8e9 100644
|
||||
--- a/subprojects/libinsane/src/workarounds/dedicated_process/worker.c
|
||||
+++ b/subprojects/libinsane/src/workarounds/dedicated_process/worker.c
|
||||
@@ -630,9 +630,11 @@ static enum lis_error execute_session_scan_read(struct lis_msg *msg_in, struct l
|
||||
{
|
||||
const void *ptr_in;
|
||||
struct lis_scan_session *session;
|
||||
+ int buffer_size;
|
||||
|
||||
ptr_in = msg_in->raw.iov_base;
|
||||
- lis_unpack(&ptr_in, "pd", &session, &msg_out->raw.iov_len);
|
||||
+ lis_unpack(&ptr_in, "pd", &session, &buffer_size);
|
||||
+ msg_out->raw.iov_len = buffer_size;
|
||||
|
||||
msg_out->raw.iov_base = malloc(msg_out->raw.iov_len);
|
||||
if (msg_out->raw.iov_base == NULL) {
|
||||
--
|
||||
2.26.2
|
||||
|
|
@ -6,6 +6,8 @@ Summary: Cross-platform access to image scanners
|
|||
License: LGPLv3+
|
||||
URL: https://doc.openpaper.work/libinsane/latest/
|
||||
Source0: https://gitlab.gnome.org/World/OpenPaperwork/%{name}/-/archive/%{version}/%{name}-%{version}.tar.gz
|
||||
# https://gitlab.gnome.org/World/OpenPaperwork/libinsane/-/merge_requests/37
|
||||
Patch0001: 0001-Fix-execute_session_scan_read-on-big-endian-machines.patch
|
||||
|
||||
BuildRequires: meson
|
||||
BuildRequires: gcc
|
||||
|
|
Loading…
Reference in New Issue