Debugger: Reject traces with negative trace amounts (fixes #2900)

This commit is contained in:
Vicki Pfau 2023-04-26 00:48:12 -07:00
parent 078ce85774
commit 5a94780871
1 changed files with 5 additions and 1 deletions

View File

@ -726,10 +726,14 @@ static void _listWatchpoints(struct CLIDebugger* debugger, struct CLIDebugVector
}
static void _trace(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
if (!dv || dv->type != CLIDV_INT_TYPE) {
if (!dv) {
debugger->backend->printf(debugger->backend, "%s\n", ERROR_MISSING_ARGS);
return;
}
if (dv->type != CLIDV_INT_TYPE || dv->intValue < 0) {
debugger->backend->printf(debugger->backend, "%s\n", ERROR_INVALID_ARGS);
return;
}
debugger->traceRemaining = dv->intValue;
if (debugger->traceVf) {