Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
f3fbd655
Unverified
Commit
f3fbd655
authored
Apr 16, 2018
by
Don Gagne
Committed by
GitHub
Apr 16, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6355 from wingtra/fix/deserializing
Guard terrain tile from reading beyond the bytearray end
parents
96f66569
83300003
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
10 deletions
+46
-10
TerrainTile.cc
src/TerrainTile.cc
+46
-10
No files found.
src/TerrainTile.cc
View file @
f3fbd655
...
...
@@ -56,21 +56,57 @@ TerrainTile::TerrainTile(QByteArray byteArray)
QDataStream
stream
(
byteArray
);
float
lat
,
lon
;
stream
>>
lat
>>
lon
;
if
(
stream
.
atEnd
())
{
qWarning
()
<<
"Terrain tile binary data does not contain all data"
;
return
;
}
stream
>>
lat
;
if
(
stream
.
atEnd
())
{
qWarning
()
<<
"Terrain tile binary data does not contain all data"
;
return
;
}
stream
>>
lon
;
_southWest
.
setLatitude
(
lat
);
_southWest
.
setLongitude
(
lon
);
stream
>>
lat
>>
lon
;
if
(
stream
.
atEnd
())
{
qWarning
()
<<
"Terrain tile binary data does not contain all data"
;
return
;
}
stream
>>
lat
;
if
(
stream
.
atEnd
())
{
qWarning
()
<<
"Terrain tile binary data does not contain all data"
;
return
;
}
stream
>>
lon
;
_northEast
.
setLatitude
(
lat
);
_northEast
.
setLongitude
(
lon
);
stream
>>
_minElevation
>>
_maxElevation
>>
_avgElevation
>>
_gridSizeLat
>>
_gridSizeLon
;
if
(
stream
.
atEnd
())
{
qWarning
()
<<
"Terrain tile binary data does not contain all data"
;
return
;
}
stream
>>
_minElevation
;
if
(
stream
.
atEnd
())
{
qWarning
()
<<
"Terrain tile binary data does not contain all data"
;
return
;
}
stream
>>
_maxElevation
;
if
(
stream
.
atEnd
())
{
qWarning
()
<<
"Terrain tile binary data does not contain all data"
;
return
;
}
stream
>>
_avgElevation
;
if
(
stream
.
atEnd
())
{
qWarning
()
<<
"Terrain tile binary data does not contain all data"
;
return
;
}
stream
>>
_gridSizeLat
;
if
(
stream
.
atEnd
())
{
qWarning
()
<<
"Terrain tile binary data does not contain all data"
;
return
;
}
stream
>>
_gridSizeLon
;
qCDebug
(
TerrainTileLog
)
<<
"Loading terrain tile: "
<<
_southWest
<<
" - "
<<
_northEast
;
qCDebug
(
TerrainTileLog
)
<<
"min:max:avg:sizeLat:sizeLon"
<<
_minElevation
<<
_maxElevation
<<
_avgElevation
<<
_gridSizeLat
<<
_gridSizeLon
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment