Skip to content

Commit

Permalink
[ept] Fix point cloud loading hang/crash (fixes #42696)
Browse files Browse the repository at this point in the history
The fixed buffer of 34 bytes may not be large enough. There could be some
extra fields in the input LAZ files. For example, the failing dataset
I got hold of was having point length of 80 bytes due to a couple
of extra fields. Checked with laz-perf devs and this should be the right
approach to get appropriately sized buffer to read points.
  • Loading branch information
wonder-sk authored and nyalldawson committed Jun 14, 2021
1 parent 94e9b33 commit e918d6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/pointcloud/qgseptdecoder.cpp
Expand Up @@ -287,7 +287,9 @@ QgsPointCloudBlock *__decompressLaz( FileType &file, const QgsPointCloudAttribut
const size_t count = f.get_header().point_count;
QgsVector3D scale( f.get_header().scale.x, f.get_header().scale.y, f.get_header().scale.z );
QgsVector3D offset( f.get_header().offset.x, f.get_header().offset.y, f.get_header().offset.z );
char buf[sizeof( laszip::formats::las::point10 ) + sizeof( laszip::formats::las::gpstime ) + sizeof( laszip::formats::las::rgb ) ]; // a buffer large enough to hold our point

QByteArray bufArray( f.get_header().point_record_length, 0 );
char *buf = bufArray.data();

const size_t requestedPointRecordSize = requestedAttributes.pointRecordSize();
QByteArray data;
Expand Down

0 comments on commit e918d6e

Please sign in to comment.