Skip to content

AML: Terminal If without Else causing UnexpectedEndOfStream in control methods #188

@alnyan

Description

@alnyan

When a DefIfElse operation appears at the end of a control method, the code parsing it throws an UnexpectedEndOfStream while trying to parse the Else part of the op.

The following ASL fails:

Method (_INI, 0, NotSerialized) {
    If ((\SCMP (\_OS, "Microsoft Windows NT") == Zero)) {
        ...
    }
    // No Else part and no other opcodes
}

And the following two examples don't (assuming they're the bodies of the same _INI method):

If ((\SCMP (\_OS, "Microsoft Windows NT") == Zero)) {
    ...
} Else {
    // May even be empty, it just needs to be there
}

and

If ((\SCMP (\_OS, "Microsoft Windows NT") == Zero)) {
    ...
}
Local1 = 0x00 // Just some random code after the If

So when parsing DefIfElse, the parser tries to read beyond the end of the stream, returning an error. A fix for this shouldn't be hard to implement, I'll try doing that, but I'm currently busy trying to implement some primitive kind of *Ref ops support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions