diff --git a/DESCRIPTION b/DESCRIPTION index ee43878..b3695d8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 = "jean-romain.roussel.1@ulaval.ca", 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"), diff --git a/NEWS.md b/NEWS.md index 0f1e06a..5324756 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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. diff --git a/src/readheader.cpp b/src/readheader.cpp index 8022836..cc4d4d4 100644 --- a/src/readheader.cpp +++ b/src/readheader.cpp @@ -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);