From a4648020d9a9fb57f6f91e7de3dacf80a6f1a9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 19 Mar 2021 09:12:42 +0100 Subject: [PATCH] Code cleanup --- src/map/IMG/rgnfile.cpp | 6 ++++-- src/map/IMG/style.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/map/IMG/rgnfile.cpp b/src/map/IMG/rgnfile.cpp index b206d3b1..59f5e562 100644 --- a/src/map/IMG/rgnfile.cpp +++ b/src/map/IMG/rgnfile.cpp @@ -58,11 +58,13 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType, break; } - if (segmentType == Polygon && poly->type == 0x10613 - && lbl && lbl->imageIdSize() && rs >= lbl->imageIdSize() + 16U) { + if (segmentType == Polygon && Style::isRaster(poly->type) && lbl + && lbl->imageIdSize()) { quint32 id; quint32 top, right, bottom, left; + if (rs < lbl->imageIdSize() + 16U) + return false; if (!(readVUInt32(hdl, lbl->imageIdSize(), id) && readUInt32(hdl, top) && readUInt32(hdl, right) && readUInt32(hdl, bottom) && readUInt32(hdl, left))) diff --git a/src/map/IMG/style.h b/src/map/IMG/style.h index a670b204..046323f8 100644 --- a/src/map/IMG/style.h +++ b/src/map/IMG/style.h @@ -131,6 +131,8 @@ public: {return (type >= 0x1400 && type <= 0x153f);} static bool isState(quint32 type) {return (type == TYPE(0x1e));} + static bool isRaster(quint32 type) + {return (type == 0x10613);} static POIClass poiClass(quint32 type);