Skip to content

Commit d31aa30

Browse files
committedMar 17, 2022
Fix ASAN USBAN gcc-12 issues
1 parent ebcefe5 commit d31aa30

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed
 

‎DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: rlas
22
Type: Package
33
Title: Read and Write 'las' and 'laz' Binary File Formats Used for Remote Sensing Data
4-
Version: 1.5.2
4+
Version: 1.5.3
55
Authors@R: c(
66
person("Jean-Romain", "Roussel", email = "jean-romain.roussel.1@ulaval.ca", role = c("aut", "cre", "cph")),
77
person("Florian", "De Boissieu", email = "", role = c("aut", "ctb"), comment = "Enable the support of .lax file and extra byte attributes"),

‎NEWS.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### rlas v1.5.3
2+
3+
- Fix gcc-asan AddressSanitizer: global-buffer-overflow on CRAN when reading las/laz with extrabytes attributes.
4+
- Fix warning: array subscript 32 is outside array bounds of ‘const char [2][-Warray-bounds]
5+
16
### rlas v1.5.2
27

38
- Fix gcc-asan AddressSanitizer: global-buffer-overflow on CRAN when reading las/laz with extrabytes attributes.

‎src/readheader.cpp

+6-15
Original file line numberDiff line numberDiff line change
@@ -364,24 +364,15 @@ List vlrsreader(LASheader* lasheader)
364364
}
365365
}
366366

367-
// Fix #53 >>>>
368-
// The if else is only a hack to avoid USBAN-ASAN error on CRAN
369-
// because I don't know how to fix it
367+
// Fix #53
370368
int len = 0 ; while(len < 32 && attemp.description[len] != '\0') len++;
369+
std::string desc;
370+
desc.resize(len);
371+
memcpy(&desc[0], &attemp.description, len);
371372

372-
if (len == 32)
373-
{
374-
std::string desc("\0", len);
375-
memcpy(&desc[0], &attemp.description, len);
376-
ExtraByte.push_back(desc);
377-
}
378-
else
379-
{
380-
ExtraByte.push_back(attemp.description);
381-
}
382-
// <<<<<<
383-
373+
ExtraByte.push_back(desc);
384374
ExtraBytenames.push_back("description");
375+
385376
ExtraByte.names() = ExtraBytenames;
386377
ExtraBytes.push_back(ExtraByte);
387378
ExtraBytesnames.push_back(attemp.name);

0 commit comments

Comments
 (0)
Please sign in to comment.