Skip to content

Commit 4d0e715

Browse files
check unwam
1 parent 7f7716c commit 4d0e715

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Marlin/src/HAL/shared/backtrace/unwarm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bool UnwReportRetAddr(UnwState * const state, uint32_t addr) {
112112
// Check if name descriptor is valid
113113
if ((v & 0xFFFFFF00) == 0xFF000000 && (v & 0xFF) > 1) {
114114
// Assume the name was found!
115-
entry.name = ((const char*)pf) - 4 - (v & 0xFF);
115+
entry.name = reinterpret_cast<const char*>(pf) - 4 - (v & 0xFF);
116116
entry.function = pf;
117117
break;
118118
}
@@ -125,7 +125,7 @@ bool UnwReportRetAddr(UnwState * const state, uint32_t addr) {
125125
/* Cast away const from reportData.
126126
* The const is only to prevent the unw module modifying the data.
127127
*/
128-
return state->cb->report((void *)state->reportData, &entry);
128+
return state->cb->report(const_cast<void *>(state->reportData), &entry);
129129
}
130130

131131
/**

Marlin/src/HAL/shared/backtrace/unwarm_arm.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,12 @@ UnwResult UnwStartArm(UnwState * const state) {
238238

239239
case 1: /* logical right */
240240
if (!regShift && shiftDist == 0) shiftDist = 32;
241-
op2val = state->regData[rm].v >> shiftDist;
241+
if (shiftDist >= 32) {
242+
op2val = 0;
243+
}
244+
else {
245+
op2val = state->regData[rm].v >> shiftDist;
246+
}
242247
break;
243248

244249
case 2: /* arithmetic right */

0 commit comments

Comments
 (0)