mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-04-14 09:29:10 +02:00
Fixed crash on TYP files with incomplete styles
This commit is contained in:
parent
ee09b2e667
commit
3a046af6b6
@ -380,6 +380,9 @@ bool Style::itemInfo(SubFile *file, SubFile::Handle &hdl,
|
|||||||
bool Style::parsePolygons(SubFile *file, SubFile::Handle &hdl,
|
bool Style::parsePolygons(SubFile *file, SubFile::Handle &hdl,
|
||||||
const Section §ion)
|
const Section §ion)
|
||||||
{
|
{
|
||||||
|
if (!section.arrayItemSize)
|
||||||
|
return section.arraySize ? false : true;
|
||||||
|
|
||||||
for (quint32 i = 0; i < section.arraySize / section.arrayItemSize; i++) {
|
for (quint32 i = 0; i < section.arraySize / section.arrayItemSize; i++) {
|
||||||
if (!file->seek(hdl, section.arrayOffset + i * section.arrayItemSize))
|
if (!file->seek(hdl, section.arrayOffset + i * section.arrayItemSize))
|
||||||
return false;
|
return false;
|
||||||
@ -493,6 +496,9 @@ bool Style::parsePolygons(SubFile *file, SubFile::Handle &hdl,
|
|||||||
bool Style::parseLines(SubFile *file, SubFile::Handle &hdl,
|
bool Style::parseLines(SubFile *file, SubFile::Handle &hdl,
|
||||||
const Section §ion)
|
const Section §ion)
|
||||||
{
|
{
|
||||||
|
if (!section.arrayItemSize)
|
||||||
|
return section.arraySize ? false : true;
|
||||||
|
|
||||||
for (quint32 i = 0; i < section.arraySize / section.arrayItemSize; i++) {
|
for (quint32 i = 0; i < section.arraySize / section.arrayItemSize; i++) {
|
||||||
if (!file->seek(hdl, section.arrayOffset + i * section.arrayItemSize))
|
if (!file->seek(hdl, section.arrayOffset + i * section.arrayItemSize))
|
||||||
return false;
|
return false;
|
||||||
@ -774,6 +780,9 @@ static bool readColorTable(SubFile *file, SubFile::Handle &hdl, QImage& img,
|
|||||||
bool Style::parsePoints(SubFile *file, SubFile::Handle &hdl,
|
bool Style::parsePoints(SubFile *file, SubFile::Handle &hdl,
|
||||||
const Section §ion)
|
const Section §ion)
|
||||||
{
|
{
|
||||||
|
if (!section.arrayItemSize)
|
||||||
|
return section.arraySize ? false : true;
|
||||||
|
|
||||||
for (quint32 i = 0; i < section.arraySize / section.arrayItemSize; i++) {
|
for (quint32 i = 0; i < section.arraySize / section.arrayItemSize; i++) {
|
||||||
if (!file->seek(hdl, section.arrayOffset + i * section.arrayItemSize))
|
if (!file->seek(hdl, section.arrayOffset + i * section.arrayItemSize))
|
||||||
return false;
|
return false;
|
||||||
@ -849,6 +858,9 @@ bool Style::parseDrawOrder(SubFile *file, SubFile::Handle &hdl,
|
|||||||
{
|
{
|
||||||
QList<quint32> drawOrder;
|
QList<quint32> drawOrder;
|
||||||
|
|
||||||
|
if (!order.arrayItemSize)
|
||||||
|
return order.arraySize ? false : true;
|
||||||
|
|
||||||
if (!file->seek(hdl, order.arrayOffset))
|
if (!file->seek(hdl, order.arrayOffset))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user