-
Bug
-
Resolution: Fixed
-
P4
-
17, 19
-
b24
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8303258 | 17.0.8-oracle | Adam Sotona | P4 | Resolved | Fixed | b01 |
JDK-8301253 | 17.0.7 | Paul Hohensee | P4 | Resolved | Fixed | b01 |
JDK-8349234 | 11.0.28-oracle | Fairoz Matte | P4 | Resolved | Fixed | master |
GCC 12 reports as following:
```
/home/ysuenaga/github-forked/jdk/src/java.base/share/native/libjli/java.c:1629:35: error: the comparison will always evaluate as 'false' for the pointer operand in 'arg + 2' must not be NULL [-Werror=address]
1629 | *nargv++ = ((arg + 2) == NULL) ? NULL : JLI_StringDup(arg + 2);
|
```
The code is here:
```
1625 /* Copy the VM arguments (i.e. prefixed with -J) */
1626 for (i = 0; i < jargc; i++) {
1627 const char *arg = jargv[i];
1628 if (arg[0] == '-' && arg[1] == 'J') {
1629 *nargv++ = ((arg + 2) == NULL) ? NULL : JLI_StringDup(a rg + 2);
1630 }
1631 }
```
It seems to be expected that `NULL` is set to new array for arguments if invalid parameter ( `-J` only) is passed.
However `NULL` in new array for arguments (`nargv`) means stop condition for argument processing in below:
```
1214 while ((arg = *argv) != 0 && *arg == '-') {
```
`jargv` in L1627 means builtin arguments which is defined by `JAVA_ARGS` or `EXTRA_JAVA_ARGS` macro. So it should be ignored and reported it in laucher trace log.
```
/home/ysuenaga/github-forked/jdk/src/java.base/share/native/libjli/java.c:1629:35: error: the comparison will always evaluate as 'false' for the pointer operand in 'arg + 2' must not be NULL [-Werror=address]
1629 | *nargv++ = ((arg + 2) == NULL) ? NULL : JLI_StringDup(arg + 2);
|
```
The code is here:
```
1625 /* Copy the VM arguments (i.e. prefixed with -J) */
1626 for (i = 0; i < jargc; i++) {
1627 const char *arg = jargv[i];
1628 if (arg[0] == '-' && arg[1] == 'J') {
1629 *nargv++ = ((arg + 2) == NULL) ? NULL : JLI_StringDup(a rg + 2);
1630 }
1631 }
```
It seems to be expected that `NULL` is set to new array for arguments if invalid parameter ( `-J` only) is passed.
However `NULL` in new array for arguments (`nargv`) means stop condition for argument processing in below:
```
1214 while ((arg = *argv) != 0 && *arg == '-') {
```
`jargv` in L1627 means builtin arguments which is defined by `JAVA_ARGS` or `EXTRA_JAVA_ARGS` macro. So it should be ignored and reported it in laucher trace log.
- backported by
-
JDK-8301253 Incorrect argument processing in java launcher
-
- Resolved
-
-
JDK-8303258 Incorrect argument processing in java launcher
-
- Resolved
-
-
JDK-8349234 Incorrect argument processing in java launcher
-
- Resolved
-
- relates to
-
JDK-8286562 GCC 12 reports some compiler warnings
-
- Resolved
-
- links to
-
Commit openjdk/jdk17u-dev/651ba865
-
Commit openjdk/jdk/26c7c92b
-
Review openjdk/jdk17u-dev/1117
-
Review openjdk/jdk/8694
(3 links to)