Skip to content

Commit

Permalink
Fix ASAN USBAN gcc-12 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Mar 17, 2022
1 parent ebcefe5 commit d31aa30
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rlas
Type: Package
Title: Read and Write 'las' and 'laz' Binary File Formats Used for Remote Sensing Data
Version: 1.5.2
Version: 1.5.3
Authors@R: c(
person("Jean-Romain", "Roussel", email = "[email protected]", role = c("aut", "cre", "cph")),
person("Florian", "De Boissieu", email = "", role = c("aut", "ctb"), comment = "Enable the support of .lax file and extra byte attributes"),
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### rlas v1.5.3

- Fix gcc-asan AddressSanitizer: global-buffer-overflow on CRAN when reading las/laz with extrabytes attributes.
- Fix warning: array subscript 32 is outside array bounds of ‘const char [2][-Warray-bounds]

### rlas v1.5.2

- Fix gcc-asan AddressSanitizer: global-buffer-overflow on CRAN when reading las/laz with extrabytes attributes.
Expand Down
21 changes: 6 additions & 15 deletions src/readheader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,24 +364,15 @@ List vlrsreader(LASheader* lasheader)
}
}

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

if (len == 32)
{
std::string desc("\0", len);
memcpy(&desc[0], &attemp.description, len);
ExtraByte.push_back(desc);
}
else
{
ExtraByte.push_back(attemp.description);
}
// <<<<<<

ExtraByte.push_back(desc);
ExtraBytenames.push_back("description");

ExtraByte.names() = ExtraBytenames;
ExtraBytes.push_back(ExtraByte);
ExtraBytesnames.push_back(attemp.name);
Expand Down

0 comments on commit d31aa30

Please sign in to comment.