From 07a271a2d5b3ba8bc70e3acf82e4e57414548b6b Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 14 Jan 2025 17:50:07 +0100 Subject: [PATCH] LERC: avoid potential integer overflow (fixes https://github.com/OSGeo/gdal/security/code-scanning/626) --- frmts/mrf/LERCV1/Lerc1Image.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frmts/mrf/LERCV1/Lerc1Image.cpp b/frmts/mrf/LERCV1/Lerc1Image.cpp index ec44b0885765..c48c321e0d39 100644 --- a/frmts/mrf/LERCV1/Lerc1Image.cpp +++ b/frmts/mrf/LERCV1/Lerc1Image.cpp @@ -957,7 +957,8 @@ bool Lerc1Image::readZTile(Byte **ppByte, size_t &nRemainingBytes, int r0, return true; } - idataVec.resize((r1 - r0) * (c1 - c0)); // max size, gets adjusted + idataVec.resize(static_cast(r1 - r0) * + (c1 - c0)); // max size, gets adjusted if (!blockread(&ptr, nRemainingBytes, idataVec)) return false;