summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/components/dispatcher/dswstate.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/components/dispatcher/dswstate.c b/source/components/dispatcher/dswstate.c
index f761ceb80..cc648e3ae 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 */