Closed pobsteta closed 6 months ago
It works all good on my computer. Please report:
rlas
version (latest commit ?)rlas
Yes it is rlas v 1.7.0 installed with librarian::shelf("r-lidar/rlas"). OS windows 11 There is a function to have this info in R ?
Please tell me if you have the same issue with this file: example.copc.laz.zip
Also please try with PDAL Autzen file https://copc.io/#example-data
The first file is ok i think ?
and with the second too.
So, it is only your COPC file that is problematic, and only on Windows. I don't have a computer running on Windows and I can't reproduce this on remote machines with your file that is too big. I'll try to investigate anyway, but won't be my priority unless you come with other problematic files.
I try on linux system. But why with old version of rlas it wirks ? I oass in 1.7 because ALSRoad wirks with.
rlas
1.7.0 supports copc files. Previous version did not. They were read and treated as regular LAZ files.
I'll run rlas with some adavanced debugging tools on linux. Yet I already tested with valgrind
and found nothing. If I find something, we will retry.
Good news, I found something wrong, but only with your file. So I should be able to debug it on Monday, hopefully. Probably not, actually. But it seems it is a problem with your file not with my code.
rlas::read.lasheader("example.copc.laz")
rlas::read.lasheader("autzen-classified.copc.laz")
rlas::read.lasheader("LHD_FXX_1042_6875_PTS_C_LAMB93_IGN69.copc.laz")
=================================================================
==487907==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60600000aa40 at pc 0x000000496e8a bp 0x7ffc13c862f0 sp 0x7ffc13c85ab8
READ of size 72 at 0x60600000aa40 thread T0
#0 0x496e89 in __asan_memcpy (/home/jr/R/R-4.3.2-asan-usban/bin/exec/R+0x496e89)
#1 0x7f66ed38fc77 in evlrsreader(LASheader*) (/home/jr/R/x86_64-pc-linux-gnu-library/4.3/rlas/libs/rlas.so+0xa84c77)
#2 0x7f66ed387a35 in lasheaderreader(Rcpp::Vector<16, Rcpp::PreserveStorage>) (/home/jr/R/x86_64-pc-linux-gnu-library/4.3/rlas/libs/rlas.so+0xa7ca35)
#3 0x7f66ed3bbd0d in _rlas_lasheaderreader (/home/jr/R/x86_64-pc-linux-gnu-library/4.3/rlas/libs/rlas.so+0xab0d0d)
#4 0x7f66f62039f6 in R_doDotCall /home/jr/R/R-4.3.2-asan-usban/src/main/dotcode.c:868:17
#5 0x7f66f637321a in bcEval /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:8002:21
#6 0x7f66f6355a61 in Rf_eval /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:1013:8
#7 0x7f66f63ba23e in R_execClosure /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c
#8 0x7f66f63b5a13 in Rf_applyClosure /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:2113:16
#9 0x7f66f6378cef in bcEval /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:7414:12
#10 0x7f66f6355a61 in Rf_eval /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:1013:8
#11 0x7f66f63ba23e in R_execClosure /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c
#12 0x7f66f63b5a13 in Rf_applyClosure /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:2113:16
#13 0x7f66f635683a in Rf_eval /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:1140:12
#14 0x7f66f64946de in Rf_ReplIteration /home/jr/R/R-4.3.2-asan-usban/src/main/main.c:262:2
#15 0x7f66f6499120 in R_ReplConsole /home/jr/R/R-4.3.2-asan-usban/src/main/main.c:314:11
#16 0x7f66f6498f44 in run_Rmainloop /home/jr/R/R-4.3.2-asan-usban/src/main/main.c:1200:5
#17 0x7f66f64992a2 in Rf_mainloop /home/jr/R/R-4.3.2-asan-usban/src/main/main.c:1207:5
#18 0x4c9abb in main /home/jr/R/R-4.3.2-asan-usban/src/main/Rmain.c:29:5
#19 0x7f66f569b082 in __libc_start_main /build/glibc-BHL3KM/glibc-2.31/csu/../csu/libc-start.c:308:16
#20 0x41f2fd in _start (/home/jr/R/R-4.3.2-asan-usban/bin/exec/R+0x41f2fd)
0x60600000aa40 is located 0 bytes to the right of 64-byte region [0x60600000aa00,0x60600000aa40)
allocated by thread T0 here:
#0 0x497d59 in realloc (/home/jr/R/R-4.3.2-asan-usban/bin/exec/R+0x497d59)
#1 0x7f66ed0a7991 in LASheader::remove_evlr(unsigned int, bool) (/home/jr/R/x86_64-pc-linux-gnu-library/4.3/rlas/libs/rlas.so+0x79c991)
#2 0x7f66ed07af69 in LASreaderLAS::open(ByteStreamIn*, bool, unsigned int) (/home/jr/R/x86_64-pc-linux-gnu-library/4.3/rlas/libs/rlas.so+0x76ff69)
#3 0x7f66ed024aff in LASreadOpener::open(char const*, bool) (/home/jr/R/x86_64-pc-linux-gnu-library/4.3/rlas/libs/rlas.so+0x719aff)
#4 0x7f66ed386b44 in lasheaderreader(Rcpp::Vector<16, Rcpp::PreserveStorage>) (/home/jr/R/x86_64-pc-linux-gnu-library/4.3/rlas/libs/rlas.so+0xa7bb44)
#5 0x7f66ed3bbd0d in _rlas_lasheaderreader (/home/jr/R/x86_64-pc-linux-gnu-library/4.3/rlas/libs/rlas.so+0xab0d0d)
#6 0x7f66f62039f6 in R_doDotCall /home/jr/R/R-4.3.2-asan-usban/src/main/dotcode.c:868:17
#7 0x7f66f637321a in bcEval /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:8002:21
#8 0x7f66f6355a61 in Rf_eval /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:1013:8
#9 0x7f66f63ba23e in R_execClosure /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c
#10 0x7f66f63b5a13 in Rf_applyClosure /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:2113:16
#11 0x7f66f6378cef in bcEval /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:7414:12
#12 0x7f66f6355a61 in Rf_eval /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:1013:8
#13 0x7f66f63ba23e in R_execClosure /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c
#14 0x7f66f63b5a13 in Rf_applyClosure /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:2113:16
#15 0x7f66f635683a in Rf_eval /home/jr/R/R-4.3.2-asan-usban/src/main/eval.c:1140:12
#16 0x7f66f64946de in Rf_ReplIteration /home/jr/R/R-4.3.2-asan-usban/src/main/main.c:262:2
#17 0x7f66f6499120 in R_ReplConsole /home/jr/R/R-4.3.2-asan-usban/src/main/main.c:314:11
#18 0x7f66f6498f44 in run_Rmainloop /home/jr/R/R-4.3.2-asan-usban/src/main/main.c:1200:5
#19 0x7f66f64992a2 in Rf_mainloop /home/jr/R/R-4.3.2-asan-usban/src/main/main.c:1207:5
#20 0x4c9abb in main /home/jr/R/R-4.3.2-asan-usban/src/main/Rmain.c:29:5
#21 0x7f66f569b082 in __libc_start_main /build/glibc-BHL3KM/glibc-2.31/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/jr/R/R-4.3.2-asan-usban/bin/exec/R+0x496e89) in __asan_memcpy
Shadow bytes around the buggy address:
0x0c0c7fff94f0: 00 00 00 02 fa fa fa fa 00 00 00 00 00 00 00 02
0x0c0c7fff9500: fa fa fa fa 00 00 00 00 00 00 00 02 fa fa fa fa
0x0c0c7fff9510: 00 00 00 00 00 00 00 00 fa fa fa fa fd fd fd fd
0x0c0c7fff9520: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
0x0c0c7fff9530: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
=>0x0c0c7fff9540: 00 00 00 00 00 00 00 00[fa]fa fa fa fd fd fd fd
0x0c0c7fff9550: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
0x0c0c7fff9560: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9570: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9580: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9590: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
Good news. Thanks for your work.
I identified the problem but I still do not understand why there is a memory corruption. The code is valid.
I pushed a temporary workaround. Please confirm it fixes your issue. Thanks
This code workd with v1.6.3 but not with v1.7.0. file link