This was caught by a static analyzer some time ago.
gcc/ada/
PR ada/98879
* terminals.c (__gnat_setup_child_communication) [_WIN32]: Add else
blocks in the processing of the data returned by ReadFile.
if (bRet == FALSE) {
cpid = -1;
}
-
- dwRet = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
- if (dwRet != 0) {
- cpid = -1;
+ else {
+ dwRet = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
+ if (dwRet != 0) {
+ cpid = -1;
+ }
+ else {
+ cpid = buf[4] | (buf[5] << 8) | (buf[6] << 16) | (buf[7] << 24);
+ }
}
- cpid = buf[4] | (buf[5] << 8) | (buf[6] << 16) | (buf[7] << 24);
process->pid = cpid;
}