Skip to content

Commit

Permalink
ready for cran for the UBSAN fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dipterix committed Feb 21, 2024
1 parent bc06511 commit ea9afe7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: readNSx
Title: Read 'Blackrock-Microsystems' Files ('NEV', 'NSx')
Version: 0.0.3.1
Version: 0.0.4
Authors@R:
person(given = "Zhengjia", family = "Wang",
email = "dipterix.wang@gmail.com", role = c("aut", "cre"))
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# readNSx 0.0.4

* Fixed a `ASAN/UBSAN` error in `read_bci2000`

# readNSx 0.0.3

* Added `read_bci2000` to read `BCI2000` data
Expand Down
15 changes: 15 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## R CMD check results

0 errors | 0 warnings | 0 note


Additional comment:

`gcc-UBSAN` error for 0.0.3:

```
readBCI.h:571:31: runtime error: load of misaligned address 0x6310000dc8bf for type 'short int', which requires 2 byte alignment
0x6310000dc8bf: note: pointer points here
00 00 01 00 80 00 d0 ff 40 ff a0 fc 90 fe 90 fe a0 01 90 ff d0 fe 50 fe 80 fd 20 fd 30 fe e0 fe
```

This was because I cast pointer (`char*`) into (`uint16_t*`). The operation has been replaced by `memcpy` with proper checks to ensure no out-of-bound access.

The new version has been checked with `rhub::check(platform = 'linux-x86_64-rocker-gcc-san')`

0 comments on commit ea9afe7

Please sign in to comment.