summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-03-27 18:31:06 +0200
committerJörg Frings-Fürst <debian@jff.email>2022-03-27 18:31:06 +0200
commit6eb7fbf271c46abaa0d2847bc269c0c9ff4d2c80 (patch)
treeaab1904173492a4d5099a361e0e6bae5cdd9d996
parenta0c2f97158701728c15a3134fabda6407596ea9e (diff)
genesys: Fix out off memory on high resultions
-rw-r--r--debian/changelog3
-rw-r--r--debian/patches/0195-genesys_fix_total_file_size_exceeding.patch100
-rw-r--r--debian/patches/series1
3 files changed, 104 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 7e37351..12ee876 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,9 @@ sane-backends (1.1.1-5) unstable; urgency=medium
hurd-i386 (Closes: #1008488).
* debian/control:
- Change Build-Depend from virtual package libltdl3-dev to libltdl-dev.
+ * New debian/patches/0195-genesys_fix_total_file_size_exceeding.patch:
+ - Fix out off memory on high resultions (Closes: #942176)
+ Cherry-picked from upstream.
-- Jörg Frings-Fürst <debian@jff.email> Sun, 27 Mar 2022 15:25:30 +0200
diff --git a/debian/patches/0195-genesys_fix_total_file_size_exceeding.patch b/debian/patches/0195-genesys_fix_total_file_size_exceeding.patch
new file mode 100644
index 0000000..4b95241
--- /dev/null
+++ b/debian/patches/0195-genesys_fix_total_file_size_exceeding.patch
@@ -0,0 +1,100 @@
+Description: Fix out off memory on high resultions
+Origin: upstream, https://gitlab.com/sane-project/backends/-/merge_requests/697
+Bug: https://gitlab.com/sane-project/backends/-/issues/580
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942176
+Forwarded: no
+Last-Update: 2022-03-27
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/backend/genesys/gl124.cpp
+===================================================================
+--- trunk.orig/backend/genesys/gl124.cpp
++++ trunk/backend/genesys/gl124.cpp
+@@ -745,7 +745,7 @@ void CommandSetGl124::init_regs_for_scan
+ dev->session = session;
+
+ dev->total_bytes_read = 0;
+- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
++ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
+
+ DBG(DBG_info, "%s: total bytes to send to frontend = %zu\n", __func__,
+ dev->total_bytes_to_read);
+Index: trunk/backend/genesys/gl646.cpp
+===================================================================
+--- trunk.orig/backend/genesys/gl646.cpp
++++ trunk/backend/genesys/gl646.cpp
+@@ -817,7 +817,8 @@ void CommandSetGl646::init_regs_for_scan
+ dev->session = session;
+
+ dev->total_bytes_read = 0;
+- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
++ dev->total_bytes_to_read = (size_t) session.output_line_bytes_requested
++ * (size_t) session.params.lines;
+
+ /* select color filter based on settings */
+ regs->find_reg(0x04).value &= ~REG_0x04_FILTER;
+Index: trunk/backend/genesys/gl841.cpp
+===================================================================
+--- trunk.orig/backend/genesys/gl841.cpp
++++ trunk/backend/genesys/gl841.cpp
+@@ -920,7 +920,7 @@ dummy \ scanned lines
+ dev->session = session;
+
+ dev->total_bytes_read = 0;
+- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
++ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
+ if (session.use_host_side_gray) {
+ dev->total_bytes_to_read /= 3;
+ }
+Index: trunk/backend/genesys/gl842.cpp
+===================================================================
+--- trunk.orig/backend/genesys/gl842.cpp
++++ trunk/backend/genesys/gl842.cpp
+@@ -568,7 +568,7 @@ void CommandSetGl842::init_regs_for_scan
+ dev->session = session;
+
+ dev->total_bytes_read = 0;
+- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
++ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
+ }
+
+ ScanSession CommandSetGl842::calculate_scan_session(const Genesys_Device* dev,
+Index: trunk/backend/genesys/gl843.cpp
+===================================================================
+--- trunk.orig/backend/genesys/gl843.cpp
++++ trunk/backend/genesys/gl843.cpp
+@@ -1041,7 +1041,7 @@ void CommandSetGl843::init_regs_for_scan
+ dev->session = session;
+
+ dev->total_bytes_read = 0;
+- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
++ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
+
+ DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read);
+ }
+Index: trunk/backend/genesys/gl846.cpp
+===================================================================
+--- trunk.orig/backend/genesys/gl846.cpp
++++ trunk/backend/genesys/gl846.cpp
+@@ -658,7 +658,7 @@ void CommandSetGl846::init_regs_for_scan
+ dev->session = session;
+
+ dev->total_bytes_read = 0;
+- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
++ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
+
+ DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read);
+ }
+Index: trunk/backend/genesys/gl847.cpp
+===================================================================
+--- trunk.orig/backend/genesys/gl847.cpp
++++ trunk/backend/genesys/gl847.cpp
+@@ -624,7 +624,7 @@ void CommandSetGl847::init_regs_for_scan
+ dev->session = session;
+
+ dev->total_bytes_read = 0;
+- dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines;
++ dev->total_bytes_to_read = (size_t)session.output_line_bytes_requested * (size_t)session.params.lines;
+
+ DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read);
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 9b8d1e2..4b9da30 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+0195-genesys_fix_total_file_size_exceeding.patch
0035-trim-libraries-in-sane-backends.pc.in.patch
0040-remove_git.patch
0100-source_spelling.patch