aws-c-common
aws-c-common copied to clipboard
memtrace: Fix underflow when stack_depth < FRAMES_TO_SKIP
Issue #, if available: N/A
Description of changes:
An underflow occurs on line 160 when stack_depth
is smaller than FRAMES_TO_SKIP
(i.e., stack_depth = 1). This occurs on riscv64 where the library fails to obtain a valid trace, which is a separate issue.
memcpy(
(void **)&stack->frames[0],
&stack_frames[FRAMES_TO_SKIP],
(stack_depth - FRAMES_TO_SKIP) * sizeof(void *)); // <-- underflow
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
I applied your patch and I still got a slightly different test failure when building on and targeting riscv64-linux-gnu. Is this related or another issue?
270/388 Test #257: test_memtrace_stacks .................................................Subprocess aborted***Exception: 0.62 sec
Fatal error condition occurred in /home/oxa/tmp/aws-c-common-build/source/source/memtrace.c:207: stack_item
Exiting Application
################################################################################
Stack trace:
################################################################################
Yes, that test needs to be skipped at the moment since memtrace cannot obtain a valid trace on riscv64. See https://github.com/zhaofengli/nixpkgs/commit/9e7cbec888e2817f64df9913362f941e59c7e0be
Yes, that test needs to be skipped at the moment since memtrace cannot obtain a valid trace on riscv64. See zhaofengli/nixpkgs@9e7cbec
That's unfortunate. Could you elaborate the issue of backtrace? Is that something related to DWARF info?
Yes, that test needs to be skipped at the moment since memtrace cannot obtain a valid trace on riscv64. See zhaofengli/nixpkgs@9e7cbec
That's unfortunate. Could you elaborate the issue of backtrace? Is that something related to DWARF info?
Sorry, I haven't had a chance to peel off the abstractions and look at that part yet.