Skip to content

Possible out-of-bounds array access in WindowGasPropertiesAtTemp() inner loop (j <= NMix should be j < NMix) #11561

@dareumnam

Description

@dareumnam

Issue overview

for (int i = 0; i < NMix; ++i) {
    for (int j = 0; j <= NMix; ++j) {  //                     ← bug here
        auto const &wmgasJ = wm->gaps[iGap].gases[j];
        // ...
    }
}
  • The valid indices for gaps[iGap].gases are 0 through NMix - 1. However, the condition j <= NMix allows j to reach NMix on the last iteration, causing gases[NMix] to be accessed, which is one element past the end of the array. This seems an out-of-bounds memory access.

Operating System (Multiple choices)

Windows

Operating System Version

11

Version of EnergyPlus

26.01

Unmethours link or helpdesk ticket number

N/A

Defect file

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    TriageIssue needs to be assessed and labeled, further information on reported might be neededUnconfirmedDefectDefect has not yet confirmed to be an actual issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions