From b6510f998a2b09ce1cc6aa591730283bb56ed800 Mon Sep 17 00:00:00 2001 From: Zequan Wu Date: Mon, 13 Dec 2021 14:40:07 -0800 Subject: [PATCH] Fix RegisterValidFlag Return CONTEXT_VALID_NONE if register num is greater than 15 or negative. Change-Id: I7203d9d51f54e5d589f9ea6fd62bbbaa71de3a4d Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3336256 Reviewed-by: Joshua Peraza --- src/google_breakpad/processor/stack_frame_cpu.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/google_breakpad/processor/stack_frame_cpu.h b/src/google_breakpad/processor/stack_frame_cpu.h index dc5d8ae6..24e28ca1 100644 --- a/src/google_breakpad/processor/stack_frame_cpu.h +++ b/src/google_breakpad/processor/stack_frame_cpu.h @@ -251,7 +251,10 @@ struct StackFrameARM : public StackFrame { // Return the ContextValidity flag for register rN. static ContextValidity RegisterValidFlag(int n) { - return ContextValidity(1 << n); + if (0 <= n && n <= 15) { + return ContextValidity(1 << n); + } + return CONTEXT_VALID_NONE; } // Register state. This is only fully valid for the topmost frame in a