diff --git a/source/components/dispatcher/dswstate.c b/source/components/dispatcher/dswstate.c index f761ceb802..cc648e3aeb 100644 --- a/source/components/dispatcher/dswstate.c +++ b/source/components/dispatcher/dswstate.c @@ -785,9 +785,14 @@ AcpiDsInitAmlWalk ( WalkState->ParserState.Aml = - WalkState->ParserState.AmlStart = AmlStart; + WalkState->ParserState.AmlStart = WalkState->ParserState.AmlEnd = - WalkState->ParserState.PkgEnd = AmlStart + AmlLength; + WalkState->ParserState.PkgEnd = AmlStart; + /* Avoid undefined behavior: applying zero offset to null pointer */ + if (AmlLength != 0) { + WalkState->ParserState.AmlEnd += AmlLength; + WalkState->ParserState.PkgEnd += AmlLength; + } /* The NextOp of the NextWalk will be the beginning of the method */