Attached is a proposed patch to fix a bug in the ECPG preprocessor that generates application code that core dumps at run-time. When the input pgc code uses a record struct for returning query results and uses an indicator struct that has fewer fields than the record struct, the generated .c code will compile with no warning but core dump. This situation comes up when a developer adds a field to an existing query, adds the field to the record struct and forgets to add the field to the indicator struct.
The patch fixes the generated code to use ECPGt_NO_INDICATOR in the call to ecpglib for indicator members that are not present and issues a compiler warning for either too few indicator members or too many indicator members.
The attached sample files are a simple sample of pgc code that can be used to see the difference in before and after generation and the before and after generated code.
If accepted, this bug fix can be back ported to earlier versions of ecpg as well.