diff --git a/sane-backends.spec b/sane-backends.spec index 27a0aa1..7808ce7 100644 --- a/sane-backends.spec +++ b/sane-backends.spec @@ -458,6 +458,7 @@ exit 0 - 1761145, 1761001, 1761051, 1761234 - genesys backend now needs gcc-c++, it is not built otherwise - 1758886 - CanoScan LiDE scanners supported by genesys backend are not detected - 1760916 - Samsung C460 does not have JPEG support +- 1761530 - genesys aborts when accessing invalid vector index and built with GLIBCXX_ASSERTIONS * Mon Sep 30 2019 Zdenek Dohnal - 1.0.28-1 - 1.0.28 diff --git a/sane-genesys-vector-glibcxxassert.patch b/sane-genesys-vector-glibcxxassert.patch new file mode 100644 index 0000000..48ed253 --- /dev/null +++ b/sane-genesys-vector-glibcxxassert.patch @@ -0,0 +1,56 @@ +diff --git a/backend/genesys_low.cc b/backend/genesys_low.cc +index 097375f..20dd3a4 100644 +--- a/backend/genesys_low.cc ++++ b/backend/genesys_low.cc +@@ -49,6 +49,11 @@ + + #include + ++template ++T safe_vec_addr(std::vector& vec, int i) ++{ ++ return vec.size() >= (unsigned long int)(i+1) ? vec[i] : (T)0; ++} + + Genesys_Device::~Genesys_Device() + { +@@ -1209,17 +1214,17 @@ SANE_Status sanei_genesys_generate_gamma_buffer(Genesys_Device * dev, + dev->settings.brightness); + for (int i = 0; i < size; i++) + { +- uint16_t value=rgamma[i]; ++ uint16_t value = safe_vec_addr(rgamma, i); + value=lut[value]; + gamma[i * 2 + size * 0 + 0] = value & 0xff; + gamma[i * 2 + size * 0 + 1] = (value >> 8) & 0xff; + +- value=ggamma[i]; ++ value = safe_vec_addr(ggamma, i); + value=lut[value]; + gamma[i * 2 + size * 2 + 0] = value & 0xff; + gamma[i * 2 + size * 2 + 1] = (value >> 8) & 0xff; + +- value=bgamma[i]; ++ value = safe_vec_addr(bgamma, i); + value=lut[value]; + gamma[i * 2 + size * 4 + 0] = value & 0xff; + gamma[i * 2 + size * 4 + 1] = (value >> 8) & 0xff; +@@ -1229,15 +1234,15 @@ SANE_Status sanei_genesys_generate_gamma_buffer(Genesys_Device * dev, + { + for (int i = 0; i < size; i++) + { +- uint16_t value=rgamma[i]; ++ uint16_t value = safe_vec_addr(rgamma, i); + gamma[i * 2 + size * 0 + 0] = value & 0xff; + gamma[i * 2 + size * 0 + 1] = (value >> 8) & 0xff; + +- value=ggamma[i]; ++ value = safe_vec_addr(ggamma, i); + gamma[i * 2 + size * 2 + 0] = value & 0xff; + gamma[i * 2 + size * 2 + 1] = (value >> 8) & 0xff; + +- value=bgamma[i]; ++ value = safe_vec_addr(bgamma, i); + gamma[i * 2 + size * 4 + 0] = value & 0xff; + gamma[i * 2 + size * 4 + 1] = (value >> 8) & 0xff; + }