-
Notifications
You must be signed in to change notification settings - Fork 159
Closed
Description
Current Behavior:
For the example below, I encounter out-of-bounds writes in SUNMatScaleAddI_Sparse at
Expected Behavior:
No out-of-bounds writes.
Steps To Reproduce:
-
Download test_SUNMatScaleAddI_Sparse.tar.gz
-
Unpack:
tar -xzf test_SUNMatScaleAddI_Sparse.tar.gz && cd test_SUNMatScaleAddI_Sparse -
Configure & build:
cmake -S. -Bbuild && cmake --build build(this might need some adaptation to find the sundials configuration) -
valgrind build/sparsetest:Invalid write of size 8 at 0x10C882: SUNMatScaleAddI_Sparse (sunmatrix_sparse.c:753) by 0x111B9C: SUNMatScaleAddI (sundials_matrix.c:201) by 0x109630: main (in build/sparsetest) Address 0x4a8f588 is 8 bytes before a block of size 312 alloc'd at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x109D07: SUNSparseMatrix (sunmatrix_sparse.c:130) by 0x10943F: main (in build/sparsetest) Invalid write of size 8 at 0x10C8C4: SUNMatScaleAddI_Sparse (sunmatrix_sparse.c:754) by 0x111B9C: SUNMatScaleAddI (sundials_matrix.c:201) by 0x109630: main (in build/sparsetest) Address 0x4a8f408 is 8 bytes before a block of size 312 alloc'd at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x109C81: SUNSparseMatrix (sunmatrix_sparse.c:127) by 0x10943F: main (in build/sparsetest)
Environment:
- SUNDIALS version: 7.1.1
- OS: Ubuntu 24.04
- Compiler: gcc 13.2.0
Anything else:
Running the same example with SUNMatScaleAddI_Sparse from sundials 6.6.2 works as expected.
It seems the problem was introduced in #257.