Skip to content

Commit c6689ed

Browse files
committed
Multiple extrabytes definition
1 parent 8b8a877 commit c6689ed

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### rlas v1.8.2
2+
3+
- Fix: can read file with multiple extra bytes definitions
4+
15
### rlas v1.8.1
26

37
- Removed a `boost` header still included in the code.

src/LASlib/lasreader_las.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,18 @@ BOOL LASreaderLAS::open(ByteStreamIn* stream, BOOL peek_only, U32 decompress_sel
804804
}
805805
else if (header.vlrs[i].record_id == 4) // ExtraBytes
806806
{
807-
header.init_attributes(header.vlrs[i].record_length_after_header/sizeof(LASattribute), (LASattribute*)header.vlrs[i].data);
807+
if (header.attribute_sizes == 0)
808+
{
809+
header.init_attributes(header.vlrs[i].record_length_after_header/sizeof(LASattribute), (LASattribute*)header.vlrs[i].data);
810+
}
811+
else
812+
{
813+
U32 number_attributes = header.vlrs[i].record_length_after_header/sizeof(LASattribute);
814+
LASattribute* attributes = (LASattribute*)header.vlrs[i].data;
815+
for (j = 0; j < (U32)number_attributes; j++)
816+
header.add_attribute(attributes[j]);
817+
}
818+
808819
for (j = 0; j < (U32)header.number_attributes; j++)
809820
{
810821
if (header.attributes[j].data_type > 10)

0 commit comments

Comments
 (0)