Actions
Bug #6301
closederror: dangling pointer ‘parameters’ to ‘temp’ may be used
Start date:
2023-12-21
Due date:
% Done:
100%
Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
12.4.1
Fixed in version:
12.4.2
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:
Description
Reported by user here: https://saxonica.plan.io/boards/4/topics/9580
In SaxonC HE 12.4.1 when the C++ samples are compiled under Debian 12 (WSL) (i.e. ./build64-linux.sh). We get the following errors:
./../Saxon.C.API/SaxonCGlue.c: In function ‘detach_graalvm_thread’:
../../Saxon.C.API/SaxonCGlue.c:63:45: warning: unused parameter ‘env’ [-Wunused-parameter]
63 | int detach_graalvm_thread(sxnc_environment *env) {
| ~~~~~~~~~~~~~~~~~~^~~
../../Saxon.C.API/SaxonCGlue.c: In function ‘checkForException’:
../../Saxon.C.API/SaxonCGlue.c:106:49: warning: unused parameter ‘environii’ [-Wunused-parameter]
106 | const char *checkForException(sxnc_environment *environii) { return 0; }
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c: In function ‘setParameter’:
../../Saxon.C.API/SaxonCGlue.c:167:4: error: dangling pointer ‘parameters’ to ‘temp’ may be used [-Werror=dangling-pointer=]
167 | (*parameters)[(*parLen) - 1].value = value->xdmvalue;
| ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:154:21: note: ‘temp’ declared here
154 | sxnc_parameter *temp =
| ^~~~
../../Saxon.C.API/SaxonCGlue.c:166:4: error: dangling pointer ‘parameters’ to ‘temp’ may be used [-Werror=dangling-pointer=]
166 | (*parameters)[(*parLen) - 1].name = (char *)newName;
| ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:154:21: note: ‘temp’ declared here
154 | sxnc_parameter *temp =
| ^~~~
../../Saxon.C.API/SaxonCGlue.c: In function ‘setProperty’:
../../Saxon.C.API/SaxonCGlue.c:196:4: error: dangling pointer ‘properties’ to ‘temp’ may be used [-Werror=dangling-pointer=]
196 | (*properties)[(*propLen)].value = (char *)newValue;
| ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:181:20: note: ‘temp’ declared here
181 | sxnc_property *temp =
| ^~~~
../../Saxon.C.API/SaxonCGlue.c:195:4: error: dangling pointer ‘properties’ to ‘temp’ may be used [-Werror=dangling-pointer=]
195 | (*properties)[(*propLen)].name = (char *)newName;
| ~^~~~~~~~~~~~
../../Saxon.C.API/SaxonCGlue.c:181:20: note: ‘temp’ declared here
181 | sxnc_property *temp =
| ^~~~
cc1: all warnings being treated as errors
Updated by O'Neil Delpratt 11 months ago
I am running SaxonC in a container on Fedora 38 and reproduced the same problem.
Updated by O'Neil Delpratt 11 months ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
- Found in version set to 12.4.1
I have fixed this by using realloc
when we resize the parameters and properties array. This change only affects the C API, but it caused compile errors of the C++ API on some linux distributions. I tested this on the Fedora 38.
Updated by O'Neil Delpratt 10 months ago
- Status changed from Resolved to Closed
- Fixed in version set to 12.4.2
Fix applied in SaxonC 12.4.2 maintenance release
Please register to edit this issue
Actions