1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Added missing label validity checks

This commit is contained in:
Martin Tůma 2019-07-01 22:53:34 +02:00
parent 5c86fc4103
commit 03d5745da9
2 changed files with 5 additions and 3 deletions

View File

@ -168,7 +168,8 @@ Label LBLFile::label(Handle &hdl, quint32 offset, bool poi)
quint32 labelOffset;
if (poi) {
quint32 poiOffset;
if (!(seek(hdl, _poiOffset + offset) && readUInt24(hdl, poiOffset)))
if (!(seek(hdl, _poiOffset + offset) && readUInt24(hdl, poiOffset)
&& (poiOffset & 0x3FFFFF)))
return QString();
labelOffset = _offset + (poiOffset & 0x3FFFFF) * _multiplier;
} else

View File

@ -205,7 +205,8 @@ bool RGNFile::polyObjects(const RectC &rect, Handle &hdl, const SubDiv *subdiv,
if (lbl && (labelPtr & 0x3FFFFF)) {
if (labelPtr & 0x800000) {
quint32 lblOff;
if (net && net->lblOffset(netHdl, labelPtr & 0x3FFFFF, lblOff))
if (net && net->lblOffset(netHdl, labelPtr & 0x3FFFFF, lblOff)
&& lblOff)
poly.label = lbl->label(lblHdl, lblOff);
} else
poly.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF);
@ -289,7 +290,7 @@ bool RGNFile::extPolyObjects(const RectC &rect, Handle &hdl,
if (subtype & 0x20) {
if (!readUInt24(hdl, labelPtr))
return false;
if (lbl)
if (lbl && (labelPtr & 0x3FFFFF))
poly.label = lbl->label(lblHdl, labelPtr & 0x3FFFFF);
}