From 7304a4bb783c8e37d01cd796915f48d09b55b0ee Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Wed, 15 Apr 2020 00:15:10 +0300 Subject: [PATCH] genesys: Fix out of bounds access during calibration on gl843 --- backend/genesys/gl843.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp index a80017998..2329b7288 100644 --- a/backend/genesys/gl843.cpp +++ b/backend/genesys/gl843.cpp @@ -2005,6 +2005,9 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso length -= (-offset); offset = 0; } + if (static_cast(length) + offset > static_cast(size)) { + length = size - offset; + } /* loop over calibration data */ for (i = 0; i < length; i++)