mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 03:33:25 +00:00
refactor(native): report bounded string reads that stop at their allowance as decode limits (#11174)
* refactor(native): report bounded string reads that stop at their allowance as decode limits * fix(verify): count generic and multi-line plain-Error limit classes
This commit is contained in:
1 parent
011cd93619
commit
6eb0e3dac6
12 files changed
+124
-47
No files matched your search
@@ -502,5 +502,18 @@
|
||||
"src/ghidra/extensions/GhidraExtensions.ts": 1,
|
||||
"src/ghidra/extensions/nativeaot/NativeAotReport.ts": 1,
|
||||
"src/javascript/analysis/JavaScriptAnalysisWorkerSchemas.ts": 2
|
||||
},
|
||||
"local-limit-error-class": {
|
||||
"src/artifacts/apple/InterfaceBuilderDecodeBudget.ts": 1,
|
||||
"src/browser/WebSourceMapFetcher.ts": 1,
|
||||
"src/captures/parseFieldDiscovery.ts": 1,
|
||||
"src/domain/analysisView/EnvironmentStateExtraction.ts": 1,
|
||||
"src/domain/native/nativeAotPe.ts": 1,
|
||||
"src/firmware/devicetree/DevicetreeParser.ts": 1,
|
||||
"src/native/elf/ElfNoteParser.ts": 1,
|
||||
"src/process/OwnedMcpStdioTransport.ts": 1,
|
||||
"src/signals/SigrokRecordingProvider.ts": 1,
|
||||
"src/signals/parseDecoderDiscovery.ts": 1,
|
||||
"src/v8/V8CodeCache.errors.ts": 1
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
} from "./counted-baseline.mjs";
|
||||
import { localCompletenessEnumCount } from "./completeness-enum-guard.mjs";
|
||||
import { countKeyedFirstMatches } from "./keyed-first-match.mjs";
|
||||
import { localLimitErrorClassCount } from "./limit-class-guard.mjs";
|
||||
|
||||
// Architecture guards for the strict-identity / best-effort-inference split.
|
||||
// - Composite dedup keys must not NUL-join variable-length or free-form
|
||||
@@ -328,6 +329,17 @@ checkCounted(
|
||||
["src/domain/analysisErrorCore.ts"],
|
||||
);
|
||||
|
||||
// A limit a parser stopped at is a ParseFailureError<"limit"> (decodeLimit in
|
||||
// src/domain/parseFailure); a refusal is an AnalysisRefusal. A local limit
|
||||
// class on plain Error hides the limit's name and maximum from both.
|
||||
checkCounted(
|
||||
"local limit class extending plain Error (use decodeLimit from src/domain/parseFailure or an AnalysisRefusal)",
|
||||
"local-limit-error-class",
|
||||
files,
|
||||
localLimitErrorClassCount,
|
||||
[],
|
||||
);
|
||||
|
||||
// A deadline is a monotonic budget owned by `Deadline` in src/domain/deadline;
|
||||
// a wall-clock sum moves with clock changes and has no finalize phase. The
|
||||
// remaining copy converts a monotonic budget for a browser page, which can
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export function localLimitErrorClassCount(content: string): number;
|
||||
@@ -0,0 +1,10 @@
|
||||
// Counts local limit classes declared on plain Error: a class whose name has
|
||||
// Limit, Budget, Exhausted or Exceeded and that extends Error directly. Type
|
||||
// parameters and line breaks between tokens are allowed, as a formatter or a
|
||||
// generic declaration may write them.
|
||||
const localLimitClass =
|
||||
/\bclass\s+\w*(?:Limit|Budget|Exhausted|Exceeded)\w*\s*(?:<[^{]*?>)?\s*extends\s+Error\b/gu;
|
||||
|
||||
/** @param {string} content */
|
||||
export const localLimitErrorClassCount = (content) =>
|
||||
content.match(localLimitClass)?.length ?? 0;
|
||||
Reference in new issue
Block a user