diff --git a/NEWS.md b/NEWS.md index 422acbd..3cf16dd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +### rlas v1.8.2 + +- Fix: can read file with multiple extra bytes definitions + ### rlas v1.8.1 - Removed a `boost` header still included in the code. diff --git a/src/LASlib/lasreader_las.cpp b/src/LASlib/lasreader_las.cpp index 657f206..6780fee 100644 --- a/src/LASlib/lasreader_las.cpp +++ b/src/LASlib/lasreader_las.cpp @@ -804,7 +804,18 @@ BOOL LASreaderLAS::open(ByteStreamIn* stream, BOOL peek_only, U32 decompress_sel } else if (header.vlrs[i].record_id == 4) // ExtraBytes { - header.init_attributes(header.vlrs[i].record_length_after_header/sizeof(LASattribute), (LASattribute*)header.vlrs[i].data); + if (header.attribute_sizes == 0) + { + header.init_attributes(header.vlrs[i].record_length_after_header/sizeof(LASattribute), (LASattribute*)header.vlrs[i].data); + } + else + { + U32 number_attributes = header.vlrs[i].record_length_after_header/sizeof(LASattribute); + LASattribute* attributes = (LASattribute*)header.vlrs[i].data; + for (j = 0; j < (U32)number_attributes; j++) + header.add_attribute(attributes[j]); + } + for (j = 0; j < (U32)header.number_attributes; j++) { if (header.attributes[j].data_type > 10)