diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2025-06-09 14:27:32 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2025-06-09 14:27:32 +0200 |
commit | 1f3f1e7d112f051f22fe7fc82739b483cef09b2a (patch) | |
tree | 7e1920e7f69782aec0d4813963c3601d62a757c1 /backend/hp5590.c | |
parent | a0fd2a8557d28ec8e7bbf881f78daf7e8e8fbd6b (diff) | |
parent | 652efae78c00b812033ea162d76cd13bd40dcab6 (diff) |
Update upstream source from tag 'upstream/1.4.0'
Update to upstream version '1.4.0'
with Debian dir fd49a717051e127a9bcd8813f3434d8d71ab8a4c
Diffstat (limited to 'backend/hp5590.c')
-rw-r--r-- | backend/hp5590.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/backend/hp5590.c b/backend/hp5590.c index 78c9313..56acfb1 100644 --- a/backend/hp5590.c +++ b/backend/hp5590.c @@ -2154,6 +2154,24 @@ sane_read_internal (struct hp5590_scanner * scanner, SANE_Byte * data, max_length, scanner->transferred_image_size); + /* + * We will truncate down the buffer size to *under* what the + * internal USB reading buffer can supply. This will avoid page read issues + * at the end of the buffer. + * + * See: https://gitlab.com/sane-project/backends/-/issues/781 + * + */ + if (max_length > BULK_READ_PAGE_SIZE * MAX_READ_PAGES) + { + DBG (DBG_proc, "%s, truncating sane_read buffer from %u to %u\n", + __func__, + max_length, + BULK_READ_PAGE_SIZE * MAX_READ_PAGES); + + max_length = BULK_READ_PAGE_SIZE * MAX_READ_PAGES; + } + SANE_Int length_limited = 0; *length = max_length; if ((unsigned long long) *length > scanner->transferred_image_size) |