Skip to content

pkg/cn-cbor: fix unaligned access [backport 2025.10]#21881

Merged
maribu merged 1 commit intoRIOT-OS:2025.10-branchfrom
maribu:backport/2025.10/pkg/cn-cbor/fix-failing-test
Nov 16, 2025
Merged

pkg/cn-cbor: fix unaligned access [backport 2025.10]#21881
maribu merged 1 commit intoRIOT-OS:2025.10-branchfrom
maribu:backport/2025.10/pkg/cn-cbor/fix-failing-test

Conversation

@maribu
Copy link
Copy Markdown
Member

@maribu maribu commented Nov 16, 2025

Backport of #21880

Contribution description

With GCC 15.2.0, the self test of cn-cbor fails. Using safe unaligned access and standard endian conversions fixes the issue.

Testing procedure

In master

git:(master) ~/Repos/software/RIOT/master ➜ make BOARD=nrf52840dk -C tests/pkg/cn-cbor flash test
make: Entering directory '/home/maribu/Repos/software/RIOT/master/tests/pkg/cn-cbor'
Building application "tests_cn-cbor" for "nrf52840dk" with CPU "nrf52".
[...]
   text	   data	    bss	    dec	    hex	filename
  17696	    132	   3076	  20904	   51a8	/home/maribu/Repos/software/RIOT/master/tests/pkg/cn-cbor/bin/nrf52840dk/tests_cn-cbor.elf
[...]
READY
s
START
main(): This is RIOT! (Version: 2026.01-devel-120-g490b5)
.
tests_cn_cbor.test_parse (tests/pkg/cn-cbor/main.c 150) exp 63 was 0
.
run 2 failures 1
{ "threads": [{ "name": "main", "stack_size": 1536, "stack_used": 768}]}

This PR

git:(pkg/cn-cbor/fix-failing-test) ~/Repos/software/RIOT/master ➜ make BOARD=nrf52840dk -C tests/pkg/cn-cbor flash test
[...]
   text	   data	    bss	    dec	    hex	filename
  17728	    132	   3076	  20936	   51c8	/home/maribu/Repos/software/RIOT/master/tests/pkg/cn-cbor/bin/nrf52840dk/tests_cn-cbor.elf
[...]
READY
s
START
main(): This is RIOT! (Version: 2026.01-devel-121-g6510c62-pkg/cn-cbor/fix-failing-test)
..
OK (2 tests)

Note

It seems that our build system does not properly update the checked out git repo when the custom patches change. As a result $(BUILD_DIR)/pkg/cn-cbor needs to be removed by hand between builds to have correct test results.

Issues/PRs references

None

With GCC 15.2.0, the self test of cn-cbor fails. Using safe unaligned
access and standard endian conversions fixes the issue.

(cherry picked from commit b44aea3)
@maribu maribu added Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Nov 16, 2025
@maribu maribu requested a review from crasbe November 16, 2025 18:40
@maribu maribu enabled auto-merge November 16, 2025 18:48
@riot-ci
Copy link
Copy Markdown

riot-ci commented Nov 16, 2025

Murdock results

✔️ PASSED

96891f0 pkg/cn-cbor: fix unaligned access

Success Failures Total Runtime
10558 0 10559 11m:44s

Artifacts

@maribu maribu added this pull request to the merge queue Nov 16, 2025
Merged via the queue into RIOT-OS:2025.10-branch with commit 501de28 Nov 16, 2025
30 checks passed
@benpicco benpicco added this to the Release 2025.10 milestone Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants