From 6eb7fbf271c46abaa0d2847bc269c0c9ff4d2c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 27 Mar 2022 18:31:06 +0200 Subject: genesys: Fix out off memory on high resultions --- ...195-genesys_fix_total_file_size_exceeding.patch | 100 +++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 101 insertions(+) create mode 100644 debian/patches/0195-genesys_fix_total_file_size_exceeding.patch (limited to 'debian/patches') 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 -- cgit v1.2.3