Github user xiaozhongwang commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1394#discussion_r161910390
--- Diff: core/conn/odb/src/odb.c ---
@@ -5313,7 +5313,7 @@ static void etabadd(char type, char *run, int id)
}
}
if ( etab[no].type == 'e' ) { /* name & create output file
*/
- for ( i = j = 0; etab[no].tgt[i] && i < sizeof(buff);
i++ ) {
+ for ( i = j = 0; i < sizeof(buff) && etab[no].tgt[i];
i++ ) {
--- End diff --
Most of time, they are equivalent. There are exception in a special case
Most of compiler judge the condition from left to right, so if the tgt is
at the end of memory, and the offset i is equal to sizeof(buff), the access to
memory goes beyond memory.
This will make a coredump, and cann't be repeatable.
---