Fix memory overrun errors in COBOL expansion routines.
Compiler fixes memory overruns in COBOL picture and expanded field handling, and prevents null pointer arithmetic.
Debugging the GDB-COBOL integration uncovered memory overrun errors in the cobol expand_picture() and expand_expanded() routines, which have now been fixed. Additionally, a fix in establish_using prevents a runtime addition of a small number to a NULL pointer on big-endian systems.
In Details
The GDB-COBOL integration development surfaced bugs in the COBOL front-end's symbol handling, specifically in genapi.cc and symbols.cc. The fixes involve using std::string for return values in expand_picture to avoid manual memory management and modifying expand_expanded to return a char* instead of modifying caller-allocated memory. A null pointer check was added to establish_using to prevent undefined behavior on big-endian platforms.