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 <jperaza@chromium.org>
This commit is contained in:
Zequan Wu 2021-12-13 14:40:07 -08:00 committed by Joshua Peraza
parent 64b25d6653
commit b6510f998a

View file

@ -251,8 +251,11 @@ struct StackFrameARM : public StackFrame {
// Return the ContextValidity flag for register rN. // Return the ContextValidity flag for register rN.
static ContextValidity RegisterValidFlag(int n) { static ContextValidity RegisterValidFlag(int n) {
if (0 <= n && n <= 15) {
return ContextValidity(1 << n); return ContextValidity(1 << n);
} }
return CONTEXT_VALID_NONE;
}
// Register state. This is only fully valid for the topmost frame in a // Register state. This is only fully valid for the topmost frame in a
// stack. In other frames, the values of nonvolatile registers may be // stack. In other frames, the values of nonvolatile registers may be