Author Topic: COBOL V6 Could Expose An Uninitialized Variable  (Read 1447 times)

Ed_Arnold

  • Hero Member
  • *****
  • Posts: 1200
    • View Profile
COBOL V6 Could Expose An Uninitialized Variable
« on: October 31, 2018, 02:00:06 PM »
Problem was after recompiling a customized ARSUPERM exit, different return codes were returned within the exit.

Reason was that the v6.2 compiler has allocated the ARSUSECA structure much lower in the stack frame than the v5.2 compiler did.                                       
                                                                       
In previous versions some variables are allocated in "new" stack memory and thus x'00', while in v6.2 they are more likely allocated in previously used memory, i.e. containing residual values if not initialized in PERMEXIT or set by the called function.                                               
                                                                       
Final change was setting those fields to x'00' resolved the issue.

The sample ARSUPERC initializes the variables correctly.

Ed
#zOS #ODF