rea-agents 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DISCLAIMER.md +136 -0
- package/README.md +67 -16
- package/THIRD_PARTY_NOTICES.md +134 -0
- package/bridge/android/ReaJadxBridge.java +123 -11
- package/bridge/cutter/rea_bridge.py +816 -0
- package/bridge/ghidra/ReaGhidraAnalysisOptions.java +38 -0
- package/bridge/ghidra/ReaGhidraBridge.java +1181 -123
- package/bridge/ghidra/ReaGhidraBundleActivator.java +14 -0
- package/bridge/ghidra/ReaGhidraMipsSoftFloat.java +176 -0
- package/bridge/ghidra/ReaGhidraPrepareRaw.java +49 -0
- package/bridge/hopper_bridge.py +103 -69
- package/bridge/mitmproxy/capture.py +189 -13
- package/bridge/native/rea_lldb_tracer.py +40 -6
- package/bridge/process/ProcessRunTokenReader.swift +76 -34
- package/bridge/pwntools/layout_impl.py +5 -0
- package/bridge/pwntools/recorded_crash_impl.py +31 -10
- package/dist/adb/AdbConfiguration.js +15 -3
- package/dist/adb/AdbDeviceOutput.js +59 -37
- package/dist/adb/AdbDirectoryListing.js +80 -0
- package/dist/adb/AdbHostFileName.js +34 -0
- package/dist/adb/AdbProvider.js +416 -173
- package/dist/adb/AdbShellOutput.js +55 -57
- package/dist/android/JadxAnalysis.js +32 -7
- package/dist/android/JadxConfiguration.js +119 -29
- package/dist/android/JadxDoctor.js +115 -0
- package/dist/android/JadxMcpTransport.js +5 -3
- package/dist/android/JadxProtocol.js +14 -0
- package/dist/android/JadxProvider.js +15 -9
- package/dist/android/JadxRelease.js +12 -1
- package/dist/android/JadxWorkspaceRoot.js +157 -0
- package/dist/apktool/ApktoolConfiguration.js +165 -22
- package/dist/apktool/ApktoolDecodeOutput.js +124 -41
- package/dist/apktool/ApktoolProvider.js +70 -33
- package/dist/application/AnalysisContextQueries.js +5 -8
- package/dist/application/AnalysisProvider.js +24 -20
- package/dist/application/AppBundleExecutable.js +5 -5
- package/dist/application/BinaryTargetResolver.js +195 -38
- package/dist/application/BrowserEvidence.js +1 -1
- package/dist/application/BrowserObservationService.js +13 -2
- package/dist/application/BrowserScenarioCaptureService.js +0 -1
- package/dist/application/CallPathTracing.js +52 -13
- package/dist/application/CapabilityInventory.js +168 -28
- package/dist/application/ClaudeDesktopConfigLocation.js +152 -0
- package/dist/application/ClientConfigurationDocument.js +102 -25
- package/dist/application/ClientConfigurationFiles.js +51 -14
- package/dist/application/ClientRegistrationEnvironment.js +10 -4
- package/dist/application/ClientRegistrationIdentity.js +94 -29
- package/dist/application/ClientRegistrationStatus.js +180 -59
- package/dist/application/DirectAnalysis.js +85 -30
- package/dist/application/DirectAnalysisStatus.js +13 -1
- package/dist/application/Doctor.js +113 -32
- package/dist/application/DoctorDiagnostics.js +34 -12
- package/dist/application/DoctorProviderIds.js +2 -0
- package/dist/application/DoctorScope.js +11 -2
- package/dist/application/DshCordisPatch.js +355 -0
- package/dist/application/DshCordisYaml.js +155 -0
- package/dist/application/EnhancedLiteralTracing.js +30 -16
- package/dist/application/EnhancedToolTypes.js +0 -1
- package/dist/application/EnhancedTools.js +164 -54
- package/dist/application/EvidenceBundleCommands.js +30 -7
- package/dist/application/EvidenceBundleFiles.js +29 -7
- package/dist/application/FunctionAnalysisEvidence.js +3 -0
- package/dist/application/GeminiClientSettings.js +25 -13
- package/dist/application/HermesConfigurationYaml.js +272 -0
- package/dist/application/InventoryProjectionEvidence.js +0 -1
- package/dist/application/InvestigationProviders.js +13 -3
- package/dist/application/JsonFiles.js +110 -20
- package/dist/application/JsonInputFile.js +220 -62
- package/dist/application/LinuxHopper.js +126 -48
- package/dist/application/MacHopper.js +21 -17
- package/dist/application/MacHopperPaths.js +40 -0
- package/dist/application/{MipsElfAbiFlags.js → MipsElfMetadata.js} +70 -9
- package/dist/application/MipsElfSharedLoad.js +164 -0
- package/dist/application/MipsGnuAttributes.js +90 -0
- package/dist/application/MsixPackageStorage.js +133 -0
- package/dist/application/ProgressReporter.js +1 -1
- package/dist/application/ProviderOperationExecution.js +11 -3
- package/dist/application/ReconstructionCoverageService.js +0 -1
- package/dist/application/ReconstructionObligationCandidates.js +3 -2
- package/dist/application/ReconstructionObligationLedgerDiagnostics.js +2 -2
- package/dist/application/ReconstructionObligationLedgerEvaluation.js +15 -33
- package/dist/application/ReconstructionObligationLedgerProjection.js +3 -72
- package/dist/application/ReconstructionObligationLedgerService.js +3 -1
- package/dist/application/ReconstructionObligationOriginalCases.js +2 -1
- package/dist/application/ReferenceSourceImport.js +24 -8
- package/dist/application/ReferenceSourceImportEntries.js +22 -21
- package/dist/application/ReferenceSourceImportTypes.js +0 -1
- package/dist/application/ReferenceSourceVcsAdapter.js +33 -16
- package/dist/application/RegularFileRead.js +46 -18
- package/dist/application/Setup.js +36 -10
- package/dist/application/SetupClientConfiguration.js +206 -37
- package/dist/application/SetupClients.js +12 -6
- package/dist/application/SetupHost.js +66 -24
- package/dist/application/SetupInstallFailure.js +42 -2
- package/dist/application/SetupPlan.js +79 -50
- package/dist/application/SetupRecoveryBackup.js +66 -0
- package/dist/application/SetupRegistrationEnvironment.js +2 -1
- package/dist/application/SetupSkill.js +323 -76
- package/dist/application/SupportedClients.js +162 -28
- package/dist/application/TypeScriptEmittedSourceCandidates.js +26 -0
- package/dist/application/Uninstall.js +273 -82
- package/dist/application/UninstallFailure.js +14 -0
- package/dist/application/Update.js +54 -25
- package/dist/application/UpdateFailure.js +17 -0
- package/dist/application/UpdateMaintenance.js +11 -29
- package/dist/application/UpdateRuntime.js +141 -27
- package/dist/application/WebModuleTraceService.js +7 -0
- package/dist/application/WebNetworkCaptureService.js +16 -7
- package/dist/application/WebSourceLocationService.js +20 -4
- package/dist/application/WindowsCapabilities.js +18 -15
- package/dist/application/WorkflowEvidence.js +24 -1
- package/dist/application/analysisView/AnalysisViewService.js +90 -12
- package/dist/application/android/AndroidPackageInspection.js +25 -0
- package/dist/application/android/AndroidSearchEvidenceSummary.js +100 -0
- package/dist/application/binary/AnalysisProviderEvaluation.js +1 -1
- package/dist/application/binary/AnalysisProviderRegistry.js +36 -21
- package/dist/application/binary/AnalysisSnapshotCache.js +41 -20
- package/dist/application/binary/AnalysisSnapshotFiles.js +75 -9
- package/dist/application/binary/BinarySession.js +248 -96
- package/dist/application/binary/BinarySessionExecution.js +5 -4
- package/dist/application/binary/BinarySessionOpen.js +13 -6
- package/dist/application/binary/BinarySessionRecords.js +33 -7
- package/dist/application/binary/BinarySessionStatus.js +93 -23
- package/dist/application/binary/BinaryTargetSummary.js +9 -0
- package/dist/application/binary/CompositeProvider.js +71 -28
- package/dist/application/binary/LazyAnalysisProvider.js +3 -1
- package/dist/application/binary/SessionProviderRouter.js +5 -2
- package/dist/application/binaryDiagnostics/BinaryLayoutService.js +11 -1
- package/dist/application/binaryDiagnostics/PeResourcesService.js +3 -0
- package/dist/application/binaryDiagnostics/RecordedCrashService.js +14 -3
- package/dist/application/captures/PacketCaptureService.js +83 -0
- package/dist/application/closeOwnedWebResources.js +7 -0
- package/dist/application/electron/ElectronFusePort.js +1 -0
- package/dist/application/electron/ElectronFuseService.js +80 -0
- package/dist/application/evm/EvmInterfaceService.js +1 -0
- package/dist/application/flutter/DartAotInspection.js +26 -0
- package/dist/application/flutter/FlutterBuildAnalysisPort.js +1 -0
- package/dist/application/flutter/FlutterBuildAnalysisService.js +13 -0
- package/dist/application/frida/FridaInstrumentationPort.js +8 -0
- package/dist/application/frida/FridaInstrumentationService.js +310 -0
- package/dist/application/frida/fridaInputErrors.js +17 -0
- package/dist/application/go/GoBinaryPort.js +1 -0
- package/dist/application/go/GoBinaryService.js +80 -0
- package/dist/application/harmony/HarmonyApplicationService.js +17 -0
- package/dist/application/investigation/EvidenceLedger.js +40 -14
- package/dist/application/investigation/InvestigationRecords.js +12 -21
- package/dist/application/investigation/UnknownEvidence.js +22 -18
- package/dist/application/javascript/ElectronActiveObservationService.js +55 -25
- package/dist/application/javascript/ElectronBoundaryAnalysis.js +17 -3
- package/dist/application/javascript/ElectronBoundaryGraph.js +2 -0
- package/dist/application/javascript/ElectronBoundaryGraphCallPaths.js +144 -0
- package/dist/application/javascript/ElectronBoundaryGraphIpc.js +26 -7
- package/dist/application/javascript/ElectronBoundaryGraphNative.js +1 -1
- package/dist/application/javascript/ElectronBoundaryGraphWindows.js +47 -9
- package/dist/application/javascript/ElectronObservationService.js +0 -1
- package/dist/application/javascript/JavaScriptApplicationEvidence.js +15 -0
- package/dist/application/javascript/JavaScriptApplicationService.js +29 -14
- package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +0 -1
- package/dist/application/javascript/JavaScriptArtifactAnalysis.js +86 -34
- package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +51 -21
- package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +31 -7
- package/dist/application/javascript/JavaScriptArtifactGraphContext.js +25 -4
- package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +25 -14
- package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +147 -41
- package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +156 -7
- package/dist/application/javascript/JavaScriptArtifactPathResolution.js +892 -181
- package/dist/application/javascript/JavaScriptArtifactReconstruction.js +43 -30
- package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +2 -0
- package/dist/application/javascript/JavaScriptModuleRelationships.js +33 -11
- package/dist/application/javascript/JavaScriptRecoveryService.js +29 -9
- package/dist/application/javascript/JavaScriptRuntimeObservationService.js +2 -1
- package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +0 -1
- package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +42 -26
- package/dist/application/javascript/JavaScriptSemanticGraphElectronProjection.js +67 -0
- package/dist/application/javascript/JavaScriptSemanticTraceService.js +0 -1
- package/dist/application/managed/ManagedApplicationGraphService.js +0 -1
- package/dist/application/managed/ManagedMemberComparisonService.js +72 -54
- package/dist/application/managed/ManagedNativeVerificationService.js +0 -1
- package/dist/application/managed/ManagedReconstructionService.js +0 -1
- package/dist/application/native/NativeCallRoutes.js +54 -34
- package/dist/application/native/NativeDispatchMetadataInspection.js +6 -2
- package/dist/application/native/NativeUiActionTrace.js +35 -22
- package/dist/application/native/NativeValueTrace.js +57 -23
- package/dist/application/pcap/PcapAnalysisPort.js +1 -0
- package/dist/application/pcap/PcapAnalysisService.js +24 -0
- package/dist/application/process/ProcessCli.js +33 -13
- package/dist/application/reverse/ReverseEngineeringCommandPort.js +1 -0
- package/dist/application/reverse/ReverseEngineeringService.js +688 -0
- package/dist/application/rust/RustBinaryPort.js +1 -0
- package/dist/application/rust/RustBinaryService.js +80 -0
- package/dist/application/signals/SignalRecordingService.js +83 -0
- package/dist/application/sqlite/SqliteDatabaseCapability.js +30 -0
- package/dist/application/sqlite/SqliteDatabasePort.js +1 -0
- package/dist/application/sqlite/SqliteDatabaseService.js +76 -0
- package/dist/application/wasm/WasmArtifactPort.js +1 -0
- package/dist/application/wasm/WasmArtifactService.js +77 -0
- package/dist/application/wasm/WasmInterfaceComparisonService.js +188 -0
- package/dist/artifacts/ArtifactHash.js +13 -2
- package/dist/artifacts/ArtifactPaths.js +4 -7
- package/dist/artifacts/ArtifactProvider.js +8 -4
- package/dist/artifacts/ArtifactReader.js +13 -1
- package/dist/artifacts/ArtifactResourceScope.js +12 -3
- package/dist/artifacts/AsarArtifactReader.js +177 -112
- package/dist/artifacts/AsarListing.js +78 -0
- package/dist/artifacts/DirectoryArtifactReader.js +94 -24
- package/dist/artifacts/MachOSliceArtifactReader.js +83 -10
- package/dist/artifacts/NativeDmgArtifactReader.js +161 -58
- package/dist/artifacts/OrderedReads.js +57 -0
- package/dist/artifacts/SafeOutputTree.js +19 -4
- package/dist/artifacts/ZipArtifactReader.js +117 -12
- package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +77 -68
- package/dist/artifacts/apple/DylibResolutionReader.js +11 -5
- package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +57 -21
- package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +64 -12
- package/dist/artifacts/apple/KeyedArchiveReader.js +3 -2
- package/dist/artifacts/apple/MachoLoadCommandReader.js +62 -61
- package/dist/artifacts/apple/NibArchive.js +11 -4
- package/dist/artifacts/apple/PlistNumberLiterals.js +2 -2
- package/dist/artifacts/extraction/ArtifactExtraction.js +6 -7
- package/dist/artifacts/hostExecutableMarking.js +16 -0
- package/dist/artifacts/inventory/ArtifactGraphConstruction.js +134 -34
- package/dist/artifacts/inventory/ArtifactInventory.js +2 -2
- package/dist/artifacts/inventory/classify.js +32 -15
- package/dist/artifacts/inventory/reader.js +36 -21
- package/dist/artifacts/inventory/scanCanonical.js +25 -18
- package/dist/artifacts/inventory/scanReader.js +36 -10
- package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +163 -7
- package/dist/artifacts/readStableArtifact.js +28 -4
- package/dist/browser/BrowserProcessStartup.js +20 -9
- package/dist/browser/BrowserScenarioPartialObservation.js +60 -44
- package/dist/browser/BrowserScenarioSecrets.js +176 -46
- package/dist/browser/CdpBrowserProvider.js +70 -99
- package/dist/browser/CdpCaptureDocuments.js +231 -69
- package/dist/browser/CdpCaptureDomSvg.js +94 -61
- package/dist/browser/CdpCaptureEventBodyShapes.js +9 -5
- package/dist/browser/CdpCaptureEventHandlers.js +23 -12
- package/dist/browser/CdpCaptureEvents.js +49 -10
- package/dist/browser/CdpCaptureStorage.js +22 -5
- package/dist/browser/CdpCaptureStorageFingerprints.js +54 -11
- package/dist/browser/CdpCaptureValues.js +0 -1
- package/dist/browser/CdpConnection.js +3 -4
- package/dist/browser/CdpElectronInspection.js +14 -4
- package/dist/browser/CdpElectronProvider.js +7 -2
- package/dist/browser/CdpElectronScripts.js +2 -1
- package/dist/browser/CdpElectronWorkers.js +7 -2
- package/dist/browser/CdpEndpoint.js +143 -17
- package/dist/browser/CdpObservationSession.js +24 -8
- package/dist/browser/CdpPageCapture.js +66 -16
- package/dist/browser/CdpPageCaptureScripts.js +4 -3
- package/dist/browser/CdpPageCaptureWorkers.js +5 -1
- package/dist/browser/CdpSafeMetadata.js +9 -5
- package/dist/browser/CdpScreenshot.js +5 -14
- package/dist/browser/CdpSnapshotStrings.js +21 -0
- package/dist/browser/CdpTargetSession.js +29 -2
- package/dist/browser/CdpWebMcpDiscovery.js +23 -6
- package/dist/browser/PlaywrightBrowserScenarioProvider.js +4 -4
- package/dist/browser/PlaywrightElectronActiveActions.js +4 -4
- package/dist/browser/PlaywrightElectronActiveProjection.js +16 -4
- package/dist/browser/PlaywrightElectronActiveProvider.js +103 -30
- package/dist/browser/PlaywrightExecutionBoundary.js +2 -2
- package/dist/browser/PlaywrightScenarioBrowser.js +9 -6
- package/dist/browser/PlaywrightScenarioEvents.js +198 -36
- package/dist/browser/PlaywrightScenarioServiceWorkers.js +249 -0
- package/dist/browser/PlaywrightScenarioSession.js +61 -29
- package/dist/browser/WebSourceMapFetcher.js +163 -80
- package/dist/browser/assets/LocalWebScriptArtifacts.js +24 -3
- package/dist/browser/assets/PublishWebScripts.js +13 -2
- package/dist/browser/assets/ScenarioScriptCapture.js +2 -1
- package/dist/browser/assets/WebArtifactReads.js +11 -3
- package/dist/browser/assets/WebSourceLocationArtifacts.js +38 -3
- package/dist/browser/history/CaptureFailures.js +22 -8
- package/dist/browser/history/CaptureFormatError.js +2 -2
- package/dist/browser/history/{HarJson.js → CaptureJson.js} +14 -4
- package/dist/browser/history/CaptureRedaction.js +16 -3
- package/dist/browser/history/CaptureRelease.js +20 -2
- package/dist/browser/history/HarCapture.js +16 -23
- package/dist/browser/history/HarSchema.js +36 -36
- package/dist/browser/history/HistoricalCaptureDecoder.js +93 -25
- package/dist/browser/history/NodeCaptureAdapter.js +48 -0
- package/dist/browser/history/{HarCaptureProcess.js → NodeCaptureProcess.js} +18 -9
- package/dist/browser/history/QlogCapture.js +385 -0
- package/dist/browser/history/SazCapture.js +130 -0
- package/dist/browser/history/SazHttp.js +61 -0
- package/dist/browser/history/SazMetadata.js +92 -0
- package/dist/browser/history/SazProjection.js +90 -0
- package/dist/browser/modules/NativeModuleResolver.js +177 -110
- package/dist/browser/modules/WebModuleArtifacts.js +40 -3
- package/dist/browser/network/PlaywrightNetworkContent.js +40 -5
- package/dist/browser/network/PlaywrightScenarioNetwork.js +125 -11
- package/dist/captures/TsharkCaptureProvider.js +370 -0
- package/dist/captures/parseFieldDiscovery.js +66 -0
- package/dist/captures/parsePacketOutput.js +21 -0
- package/dist/catalogIdentity.js +46 -35
- package/dist/cli/adbCommands.js +2 -2
- package/dist/cli/analysisViewCommands.js +1 -1
- package/dist/cli/androidCommands.js +11 -2
- package/dist/cli/apktoolCommands.js +10 -11
- package/dist/cli/applicationCommands.js +44 -17
- package/dist/cli/artifactCommands.js +1 -1
- package/dist/cli/binaryDiagnosticsCommands.js +14 -10
- package/dist/cli/browserAdvancedCommands.js +37 -24
- package/dist/cli/browserCommands.js +46 -29
- package/dist/cli/captureCommands.js +72 -0
- package/dist/cli/cliResultOutput.js +188 -0
- package/dist/cli/coreBinaryCommands.js +73 -27
- package/dist/cli/coreNativeCommands.js +53 -31
- package/dist/cli/cutterCommands.js +50 -0
- package/dist/cli/electronCommands.js +45 -3
- package/dist/cli/evmCommands.js +4 -5
- package/dist/cli/finishAnalysisCommand.js +44 -0
- package/dist/cli/firmwareCommands.js +14 -36
- package/dist/cli/flutterCommands.js +69 -0
- package/dist/cli/fridaCommands.js +211 -0
- package/dist/cli/goCommands.js +20 -0
- package/dist/cli/interactiveSetup.js +11 -1
- package/dist/cli/javascriptApplicationAnalysis.js +1 -1
- package/dist/cli/javascriptRecoveryCommands.js +7 -0
- package/dist/cli/jsonOutput.js +2 -2
- package/dist/cli/managedCommands.js +31 -3
- package/dist/cli/options.js +20 -2
- package/dist/cli/pcapCommands.js +47 -0
- package/dist/cli/processCommands.js +1 -1
- package/dist/cli/reverseEngineeringCommands.js +268 -0
- package/dist/cli/rustCommands.js +21 -0
- package/dist/cli/setupCommands.js +40 -12
- package/dist/cli/signalCommands.js +72 -0
- package/dist/cli/sqliteCommands.js +79 -0
- package/dist/cli/utilityCommands.js +116 -74
- package/dist/cli/wasmCommands.js +61 -0
- package/dist/cli/webModuleCommands.js +36 -32
- package/dist/cli/webNetworkCaptureCommands.js +8 -8
- package/dist/cli-runtime/AbortablePromise-BVBemxbD.js +123 -0
- package/dist/cli-runtime/AnalysisProvider-D0Us2OTk.js +27 -0
- package/dist/cli-runtime/AnalysisSnapshotCache-BXS0wRd2.js +710 -0
- package/dist/cli-runtime/ArtifactReader-BXkffc1D.js +55 -0
- package/dist/cli-runtime/ArtifactResourceScope-DQWTcUwE.js +114 -0
- package/dist/cli-runtime/AsarHeader-CnzOzYEH.js +31 -0
- package/dist/cli-runtime/BinarySessionStatus-DnMxMk-r.js +211 -0
- package/dist/cli-runtime/BinaryTargetResolver-CVIJ_s1A.js +1308 -0
- package/dist/cli-runtime/BoundedFileBytes-BU30odTm.js +39 -0
- package/dist/cli-runtime/CdpTargetSession-DGX5pV9w.js +650 -0
- package/dist/cli-runtime/ClientConfigPath-c6jr6INc.js +36 -0
- package/dist/cli-runtime/ClientConfigurationDocument-ffQ9X0Se.js +1957 -0
- package/dist/cli-runtime/ClientRegistrationStatus-DszCyPEU.js +509 -0
- package/dist/cli-runtime/CurrentEntrypointPath-D5FRNdkq.js +14 -0
- package/dist/cli-runtime/DirectAnalysis-BgvAtpN3.js +528 -0
- package/dist/cli-runtime/Doctor-DIpf_I7N.js +588 -0
- package/dist/cli-runtime/ElectronFileScope-dpHm2nrS.js +1054 -0
- package/dist/cli-runtime/ExecFileOutput-BEQs-lDD.js +117 -0
- package/dist/cli-runtime/IdaConfiguration-CtGP7EKo.js +1094 -0
- package/dist/cli-runtime/InterfaceBuilderDecodeBudget-D4omRUe4.js +279 -0
- package/dist/cli-runtime/InventoryProjectionEvidence-DIsI4DJ6.js +49 -0
- package/dist/cli-runtime/InvestigationProviders-DoQRIHii.js +117 -0
- package/dist/cli-runtime/JavaScriptApplicationEvidenceGraph-D5aI_FSJ.js +160 -0
- package/dist/cli-runtime/JavaScriptApplicationWorkflowEvidence-Bz4-V0Ct.js +75 -0
- package/dist/cli-runtime/JavaScriptWorkerMemoryLimit-B1bwMM1a.js +86 -0
- package/dist/cli-runtime/JebMcpEndpoint-DUytrn5G.js +428 -0
- package/dist/cli-runtime/JsonFiles-DQa1PRKy.js +708 -0
- package/dist/cli-runtime/MacCodeSignature-MgYbRK_H.js +24 -0
- package/dist/cli-runtime/MacHopperPaths-CwL5lYPX.js +434 -0
- package/dist/cli-runtime/MachoLoadCommandReader-C7e074Ze.js +510 -0
- package/dist/cli-runtime/ManagedSnapshot-rqyBHcdL.js +4185 -0
- package/dist/cli-runtime/OwnedCommand-Cj9GhmPR.js +112 -0
- package/dist/cli-runtime/PrivateRuntimeRoot-DAy0PiBM.js +263 -0
- package/dist/cli-runtime/ProcessOwnership-DXC5-UWt.js +1378 -0
- package/dist/cli-runtime/ProviderDeadline-8m2pFRDc.js +122 -0
- package/dist/cli-runtime/RegularFile-B_6KPCNQ.js +139 -0
- package/dist/cli-runtime/RegularFileRead-DVlC5faM.js +125 -0
- package/dist/cli-runtime/SafeOutputTree-D6U15GXd.js +524 -0
- package/dist/cli-runtime/SetupHost-FkYWswsq.js +1098 -0
- package/dist/cli-runtime/SupportedClients-DaX6Lt2d.js +1049 -0
- package/dist/cli-runtime/UninstallFailure-1blyKXHE.js +22 -0
- package/dist/cli-runtime/Update-CbTC_eg1.js +143 -0
- package/dist/cli-runtime/UpdateFailure-BcFNxEZZ.js +24 -0
- package/dist/cli-runtime/ZipArtifactReader-B8ZgNe4D.js +248 -0
- package/dist/cli-runtime/analysisErrorCleanup-Do6YeeoD.js +32 -0
- package/dist/cli-runtime/analysisErrorPresentation-DGt7TdsH.js +497 -0
- package/dist/cli-runtime/appleArchiveFormat-tVoI2ykA.js +263 -0
- package/dist/cli-runtime/application__DirectAnalysisStatus-DpOejOf0.js +150 -0
- package/dist/cli-runtime/application__EnhancedTools-oFE2bOjs.js +1787 -0
- package/dist/cli-runtime/application__FunctionAnalysisEvidence-B6osuhvW.js +41 -0
- package/dist/cli-runtime/application__ReconstructionCoverageService-DN3wTFQj.js +32 -0
- package/dist/cli-runtime/application__ReconstructionObligationLedgerService-CKcTppX9.js +815 -0
- package/dist/cli-runtime/application__Setup-XpMaRNjy.js +514 -0
- package/dist/cli-runtime/application__Uninstall-_23pU2yB.js +427 -0
- package/dist/cli-runtime/application__UpdateRuntime-DPvY8ohd.js +345 -0
- package/dist/cli-runtime/application__android__AndroidApplicationService-CFgIFPM4.js +31 -0
- package/dist/cli-runtime/application__apple__AppleApplicationService-Db6QCsun.js +31 -0
- package/dist/cli-runtime/application__harmony__HarmonyApplicationService-CFjocHoK.js +31 -0
- package/dist/cli-runtime/application__javascript__ElectronActiveObservationService-CmVDUI_Z.js +118 -0
- package/dist/cli-runtime/application__javascript__ElectronObservationService-DEsR8KDN.js +63 -0
- package/dist/cli-runtime/application__javascript__JavaScriptApplicationService-CCkp8KBh.js +11450 -0
- package/dist/cli-runtime/application__javascript__JavaScriptApplicationWorkflowService-lPy0tzr3.js +2329 -0
- package/dist/cli-runtime/application__javascript__JavaScriptRuntimeReconciliationService-DWleA8K9.js +88 -0
- package/dist/cli-runtime/application__javascript__JavaScriptSemanticTraceService-DkALH4rL.js +299 -0
- package/dist/cli-runtime/artifactOperationError-B7n03FbD.js +27 -0
- package/dist/cli-runtime/artifacts__ArtifactProvider-zXI0QjSL.js +2187 -0
- package/dist/cli-runtime/binary-BVOr2mgE.js +14206 -0
- package/dist/cli-runtime/browserObservationError-Dx6xRTjb.js +40 -0
- package/dist/cli-runtime/catalogIdentity-DLoXgfIR.js +933 -0
- package/dist/cli-runtime/cli.js +41848 -0
- package/dist/cli-runtime/cliOutput-BC1BdAcB.js +122 -0
- package/dist/cli-runtime/cliOutput.js +5 -0
- package/dist/cli-runtime/cliResultOutput-DsRMI8CJ.js +780 -0
- package/dist/cli-runtime/cliResultOutput.js +5 -0
- package/dist/cli-runtime/composition__browserScenario-DHXC1a8n.js +2927 -0
- package/dist/cli-runtime/composition__electronObservation-GecK2EID.js +555 -0
- package/dist/cli-runtime/composition__electronScenario-CEZnVrAL.js +653 -0
- package/dist/cli-runtime/cutterToolContracts-TZH9EHr5.js +5134 -0
- package/dist/cli-runtime/doctorRuntime-BE5ZX8it.js +258 -0
- package/dist/cli-runtime/dotnet__ManagedStaticProvider-C8_yZCDc.js +5 -0
- package/dist/cli-runtime/errorSchemas-CTRmvMl3.js +601 -0
- package/dist/cli-runtime/javascriptApplicationAnalysis-HgMzVMQw.js +2068 -0
- package/dist/cli-runtime/javascriptExportReturnShapeProjection-Dg00g35t.js +78 -0
- package/dist/cli-runtime/javascriptExportShapeComparisonSchemas-BYnoIqIk.js +1242 -0
- package/dist/cli-runtime/javascriptRuntimeReconciliation-DNjDoL3S.js +1507 -0
- package/dist/cli-runtime/javascriptRuntimeReconciliationSchemas-BWpGWNcI.js +247 -0
- package/dist/cli-runtime/javascriptSemanticTraceSchemas-BTCNcvbc.js +126 -0
- package/dist/cli-runtime/lipo-DSWP6fv-.js +396 -0
- package/dist/cli-runtime/logger-CQQCI4a2.js +48 -0
- package/dist/cli-runtime/machoContainer-C8BIkkq3.js +172 -0
- package/dist/cli-runtime/managedApplicationGraph-B08jb3jq.js +1130 -0
- package/dist/cli-runtime/managedToolContracts-D60QmIYj.js +99 -0
- package/dist/cli-runtime/mcpDoctor.js +359 -0
- package/dist/cli-runtime/mcpStartupPolicy-CVVSOmRc.js +21 -0
- package/dist/cli-runtime/native__NativeMacOSProvider-YBTvUeJO.js +4875 -0
- package/dist/cli-runtime/officialToolContracts-CCFF0an9.js +1501 -0
- package/dist/cli-runtime/propertyListKeys-G8e74YWb.js +248 -0
- package/dist/cli-runtime/providerAdapterError-DAjhICdr.js +25 -0
- package/dist/cli-runtime/providerCleanupError-Ceq8f0wK.js +27 -0
- package/dist/cli-runtime/providerIdentities-Ao1XTvwx.js +31 -0
- package/dist/cli-runtime/providerStartupTimeout-B2tF2LtZ.js +17 -0
- package/dist/cli-runtime/readFileHandleChunks-dp60iZ6v.js +38 -0
- package/dist/cli-runtime/reconstructionObligationLedgerSchemas-Bao0xMr-.js +19478 -0
- package/dist/cli-runtime/rolldown-runtime-DXoylpqc.js +121 -0
- package/dist/cli-runtime/runtimeVersion-CMGd0bDu.js +23 -0
- package/dist/cli-runtime/safeJson-DKKACtdy.js +25 -0
- package/dist/cli-runtime/scanCanonical-KP4T9jSl.js +2724 -0
- package/dist/cli-runtime/snapshotEnvironment-D_tWyOub.js +813 -0
- package/dist/cli-runtime/toolContracts-D2FOG_Nb.js +3721 -0
- package/dist/cli-runtime/toolOutputSchemaGroups-DRiYs1je.js +12070 -0
- package/dist/cli-runtime/workflowInputError-n8Oo-bLA.js +26 -0
- package/dist/cli.js +38 -5
- package/dist/cliBrowserScenarioCommands.js +39 -4
- package/dist/cliCommandNames.js +48 -0
- package/dist/cliEvidenceCommands.js +0 -1
- package/dist/cliJavaScriptRuntimeCommands.js +16 -14
- package/dist/cliJsonInput.js +12 -4
- package/dist/cliLogging.js +50 -14
- package/dist/cliObservationOptions.js +6 -0
- package/dist/cliOutput.js +38 -5
- package/dist/composition/binary.js +4 -0
- package/dist/composition/captures.js +3 -0
- package/dist/composition/directAnalysis.js +28 -11
- package/dist/composition/electronFuses.js +4 -0
- package/dist/composition/evm.js +12 -0
- package/dist/composition/flutter.js +3 -0
- package/dist/composition/go.js +4 -0
- package/dist/composition/javascriptAnalysisWorkerProcess.js +5 -4
- package/dist/composition/jeb.js +33 -4
- package/dist/composition/pcap.js +3 -0
- package/dist/composition/resolveWindowsProviderExecutable.js +61 -0
- package/dist/composition/reverseEngineering.js +29 -0
- package/dist/composition/rust.js +4 -0
- package/dist/composition/signals.js +3 -0
- package/dist/composition/sqlite.js +4 -0
- package/dist/composition/wasm.js +22 -0
- package/dist/composition/webNetworkCaptures.js +7 -2
- package/dist/config/environment.js +45 -4
- package/dist/config/ghidraDisabledAnalyzers.js +25 -0
- package/dist/config/homeDirectory.js +9 -6
- package/dist/config/mcpInputSchemaProfile.js +4 -0
- package/dist/config/mcpOutputSchemaProfile.js +22 -0
- package/dist/config/parseConfig.js +21 -31
- package/dist/config/parsers.js +4 -3
- package/dist/config/{ghidraStartupTimeout.js → providerStartupTimeout.js} +7 -3
- package/dist/contracts/adb/adbToolContracts.js +7 -7
- package/dist/contracts/analysisDetail.js +6 -3
- package/dist/contracts/analysisViewApiSurfaceExample.js +68 -0
- package/dist/contracts/analysisViewToolContracts.js +24 -3
- package/dist/contracts/android/androidToolContracts.js +17 -8
- package/dist/contracts/applicationToolContracts.js +17 -2
- package/dist/contracts/artifactToolContracts.js +14 -2
- package/dist/contracts/browserToolContracts.js +1 -0
- package/dist/contracts/captures/captureToolContracts.js +42 -0
- package/dist/contracts/compactInputSchema.js +26 -6
- package/dist/contracts/cutterToolContracts.js +84 -0
- package/dist/contracts/enhancedToolContracts.js +2 -2
- package/dist/contracts/evm/evmToolContracts.js +30 -15
- package/dist/contracts/firmware/firmwareToolContracts.js +1 -1
- package/dist/contracts/flutter/flutterToolContracts.js +47 -0
- package/dist/contracts/fridaRemoteAddress.js +23 -0
- package/dist/contracts/fridaToolContracts.js +273 -0
- package/dist/contracts/functionComparisonExample.js +12 -1
- package/dist/contracts/gdbToolContracts.js +103 -0
- package/dist/contracts/go/goToolContracts.js +20 -0
- package/dist/contracts/hopperMemoryContracts.js +15 -0
- package/dist/contracts/inputSchemaPresentation.js +81 -14
- package/dist/contracts/investigationExamples.js +1 -0
- package/dist/contracts/javascript/electronToolContracts.js +27 -2
- package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +13 -1
- package/dist/contracts/managed/managedToolContracts.js +43 -4
- package/dist/contracts/managed/managedWorkflowExamples.js +7 -1
- package/dist/contracts/managed/managedWorkflowToolContracts.js +4 -30
- package/dist/contracts/mobileApplicationGraphExamples.js +12 -0
- package/dist/contracts/native/binaryDiagnosticsToolContracts.js +3 -2
- package/dist/contracts/native/nativeToolContracts.js +10 -6
- package/dist/contracts/officialToolContracts.js +5 -5
- package/dist/contracts/pcap/pcapToolContracts.js +33 -0
- package/dist/contracts/providerSelection.js +1 -0
- package/dist/contracts/reconstructionReadinessExample.js +126 -119
- package/dist/contracts/reverseEngineeringToolContracts.js +52 -0
- package/dist/contracts/rizinDebugToolContracts.js +96 -0
- package/dist/contracts/rust/rustToolContracts.js +20 -0
- package/dist/contracts/sessionLifecycleInputs.js +34 -2
- package/dist/contracts/sessionToolContracts.js +2 -2
- package/dist/contracts/sessionToolSchemas.js +14 -0
- package/dist/contracts/signals/signalToolContracts.js +40 -0
- package/dist/contracts/sqlite/sqliteToolContracts.js +36 -0
- package/dist/contracts/toolContractExamples.js +29 -0
- package/dist/contracts/toolContractTypes.js +2 -0
- package/dist/contracts/toolContracts.js +26 -0
- package/dist/contracts/toolEffects.js +247 -8
- package/dist/contracts/toolOutputSchemaGroups.js +75 -32
- package/dist/contracts/toolOutputSchemaPrimitives.js +111 -10
- package/dist/contracts/toolSchemaMetadata.js +16 -2
- package/dist/contracts/unknownContractExamples.js +1 -1
- package/dist/contracts/wasm/wasmComparisonContracts.js +52 -0
- package/dist/contracts/wasm/wasmToolContracts.js +33 -0
- package/dist/contracts/webNetworkCaptureToolContracts.js +15 -4
- package/dist/cutter/CutterBridgeClient.js +621 -0
- package/dist/cutter/CutterBridgeService.js +139 -0
- package/dist/doctorRuntime.js +20 -8
- package/dist/domain/adb/adbDeviceAnalysis.js +26 -4
- package/dist/domain/analysisErrorBase.js +20 -0
- package/dist/domain/analysisErrorCleanup.js +1 -1
- package/dist/domain/analysisErrorCore.js +19 -0
- package/dist/domain/analysisErrorPresentation.js +58 -17
- package/dist/domain/analysisErrorProjection.js +31 -12
- package/dist/domain/analysisProfile.js +7 -3
- package/dist/domain/analysisSnapshot.js +311 -184
- package/dist/domain/analysisView/WebNetworkApiSurfaceAccumulator.js +414 -0
- package/dist/domain/analysisView/analysisView.js +366 -44
- package/dist/domain/analysisView/analysisViewCoverage.js +32 -0
- package/dist/domain/analysisView/analysisViewErrors.js +4 -0
- package/dist/domain/analysisView/analysisViewParent.js +12 -0
- package/dist/domain/analysisView/analysisViewText.js +29 -0
- package/dist/domain/analysisView/androidPackageView.js +102 -0
- package/dist/domain/analysisView/artifactInventoryView.js +140 -0
- package/dist/domain/analysisView/binaryLayoutView.js +11 -4
- package/dist/domain/analysisView/dartAotView.js +93 -0
- package/dist/domain/analysisView/evmInterfaceView.js +105 -0
- package/dist/domain/analysisView/interfaceBuilderView.js +182 -0
- package/dist/domain/analysisView/javascriptApplicationView.js +29 -28
- package/dist/domain/analysisView/machoView.js +186 -0
- package/dist/domain/analysisView/managedArtifactView.js +108 -0
- package/dist/domain/analysisView/managedMemberView.js +209 -0
- package/dist/domain/analysisView/nativeFunctionView.js +20 -25
- package/dist/domain/analysisView/pcapCaptureView.js +264 -0
- package/dist/domain/analysisView/qlogCaptureView.js +198 -0
- package/dist/domain/analysisView/wasmArtifactView.js +162 -0
- package/dist/domain/analysisView/webNetworkApiSurfaceView.js +123 -0
- package/dist/domain/analysisView/webNetworkCaptureView.js +388 -0
- package/dist/domain/android/androidAnalysis.js +36 -2
- package/dist/domain/android/androidApplication.js +32 -60
- package/dist/domain/apktool/apktoolResourceAnalysis.js +19 -7
- package/dist/domain/apple/appleApplication.js +31 -29
- package/dist/domain/apple/appleArchiveFormat.js +184 -0
- package/dist/domain/apple/appleAssetCatalog.js +15 -0
- package/dist/domain/apple/appleBundleAnatomy.js +1 -1
- package/dist/domain/apple/dyldPaths.js +9 -2
- package/dist/domain/apple/dylibResolution.js +19 -9
- package/dist/domain/apple/dylibResolutionFindings.js +8 -9
- package/dist/domain/apple/interfaceBuilderGraph.js +50 -26
- package/dist/domain/apple/interfaceBuilderKeyedArchive.js +28 -8
- package/dist/domain/apple/machoContainer.js +120 -8
- package/dist/domain/apple/machoCpuIdentity.js +4 -0
- package/dist/domain/apple/plistValue.js +6 -1
- package/dist/domain/artifactComparison.js +109 -32
- package/dist/domain/artifactDecompressionBudget.js +26 -0
- package/dist/domain/artifactGraph.js +23 -6
- package/dist/domain/artifactIdentity.js +4 -1
- package/dist/domain/artifactInspection.js +44 -2
- package/dist/domain/artifactInventoryEvidence.js +137 -39
- package/dist/domain/binaryTarget.js +251 -94
- package/dist/domain/binaryTargetTypes.js +14 -1
- package/dist/domain/browserNetworkEvidence.js +4 -0
- package/dist/domain/browserObservation.js +88 -29
- package/dist/domain/browserObservationSchemas.js +4 -1
- package/dist/domain/browserScenarioCapture.js +2 -1
- package/dist/domain/browserScenarioCaptureValues.js +26 -2
- package/dist/domain/browserScenarioDiff.js +120 -11
- package/dist/domain/browserScenarioDiffEvidence.js +46 -13
- package/dist/domain/browserScenarioDiffValues.js +10 -3
- package/dist/domain/browserScenarioNetworkComparison.js +158 -0
- package/dist/domain/browserScenarioNormalization.js +10 -13
- package/dist/domain/browserScenarioValues.js +2 -12
- package/dist/domain/browserSession.js +2 -2
- package/dist/domain/bundleComparison.js +1 -5
- package/dist/domain/callPath.js +40 -3
- package/dist/domain/captures/packetCapture.js +138 -0
- package/dist/domain/captures/packetFields.js +81 -0
- package/dist/domain/changedBehavior.js +43 -41
- package/dist/domain/comparisonSourceEvidence.js +6 -0
- package/dist/domain/dosCom.js +2 -2
- package/dist/domain/dosMz.js +52 -14
- package/dist/domain/electron/electronFuses.js +360 -0
- package/dist/domain/elfFixedHeader.js +42 -0
- package/dist/domain/evidence.js +103 -38
- package/dist/domain/evidenceBundle.js +58 -20
- package/dist/domain/evidenceErrors.js +5 -0
- package/dist/domain/evm/evmInterface.js +18 -4
- package/dist/domain/evm/solidityMetadata.js +70 -0
- package/dist/domain/explicitSensitiveFailure.js +42 -24
- package/dist/domain/firmware/firmwareAnalysis.js +29 -0
- package/dist/domain/flutter/flutterBuildAnalysis.js +141 -0
- package/dist/domain/functionCallCoverage.js +60 -0
- package/dist/domain/functionComparisonDimensions.js +101 -10
- package/dist/domain/functionComparisonNormalization.js +66 -10
- package/dist/domain/functionComparisonResults.js +7 -6
- package/dist/domain/functionComparisonSchemas.js +14 -3
- package/dist/domain/functionDossierEvidence.js +3 -0
- package/dist/domain/go/goBinary.js +96 -0
- package/dist/domain/harmony/harmonyApplication.js +156 -0
- package/dist/domain/hopperErrors.js +15 -16
- package/dist/domain/hopperPublisher.js +12 -0
- package/dist/domain/hopperValues.js +112 -34
- package/dist/domain/javascript/electronObservation.js +4 -1
- package/dist/domain/javascript/electronStaticAnalysisBrowser.js +15 -14
- package/dist/domain/javascript/electronStaticAnalysisIpc.js +3 -1
- package/dist/domain/javascript/electronStaticAnalysisNative.js +19 -5
- package/dist/domain/javascript/electronStaticAnalysisValues.js +14 -8
- package/dist/domain/javascript/electronWrappedCallPaths.js +498 -0
- package/dist/domain/javascript/htmlArtifactReferences.js +94 -4
- package/dist/domain/javascript/javascriptAnalysisResourceControls.js +21 -1
- package/dist/domain/javascript/javascriptApplicationAnalysis.js +3 -0
- package/dist/domain/javascript/javascriptApplicationChangeGraph.js +7 -2
- package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +1 -1
- package/dist/domain/javascript/javascriptApplicationGraph.js +17 -1
- package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +1 -0
- package/dist/domain/javascript/javascriptApplicationProjectionResources.js +8 -0
- package/dist/domain/javascript/javascriptApplicationVersionKeys.js +31 -18
- package/dist/domain/javascript/javascriptArtifactFiles.js +2 -1
- package/dist/domain/javascript/javascriptAstFingerprint.js +51 -17
- package/dist/domain/javascript/javascriptAstValues.js +52 -3
- package/dist/domain/javascript/javascriptBootstrap.js +94 -0
- package/dist/domain/javascript/javascriptBootstrapIntegrity.js +372 -0
- package/dist/domain/javascript/javascriptBuiltinResourceMethods.js +8 -0
- package/dist/domain/javascript/javascriptBundledRequireOrigin.js +291 -0
- package/dist/domain/javascript/javascriptContextBridgeExposure.js +23 -0
- package/dist/domain/javascript/javascriptElectronMemberWrites.js +86 -22
- package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +6 -5
- package/dist/domain/javascript/javascriptExportShapeVariants.js +1 -1
- package/dist/domain/javascript/javascriptFeatureSeed.js +33 -16
- package/dist/domain/javascript/javascriptFeatureTrace.js +9 -3
- package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +42 -11
- package/dist/domain/javascript/javascriptIntrinsicInvocation.js +132 -0
- package/dist/domain/javascript/javascriptModuleDeclaration.js +28 -0
- package/dist/domain/javascript/javascriptModuleInterop.js +618 -0
- package/dist/domain/javascript/javascriptModuleResolutionMode.js +18 -0
- package/dist/domain/javascript/javascriptModuleSpecifier.js +5 -0
- package/dist/domain/javascript/javascriptNativeHandoff.js +0 -1
- package/dist/domain/javascript/javascriptPackageImportAliases.js +58 -0
- package/dist/domain/javascript/javascriptRecovery.js +12 -5
- package/dist/domain/javascript/javascriptRpcEndpoints.js +119 -41
- package/dist/domain/javascript/javascriptRuntimeLoadState.js +11 -0
- package/dist/domain/javascript/javascriptRuntimeObservation.js +4 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +10 -4
- package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +15 -2
- package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +0 -1
- package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +5 -4
- package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +113 -11
- package/dist/domain/javascript/javascriptSemanticAmbientWrites.js +251 -0
- package/dist/domain/javascript/javascriptSemanticAnalysis.js +340 -108
- package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +17 -34
- package/dist/domain/javascript/javascriptSemanticCallResolution.js +4 -3
- package/dist/domain/javascript/javascriptSemanticCallableStack.js +52 -0
- package/dist/domain/javascript/javascriptSemanticCalls.js +6 -11
- package/dist/domain/javascript/javascriptSemanticChildProcesses.js +42 -55
- package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +428 -32
- package/dist/domain/javascript/javascriptSemanticDataEffects.js +14 -20
- package/dist/domain/javascript/javascriptSemanticDependencies.js +69 -0
- package/dist/domain/javascript/javascriptSemanticFingerprints.js +11 -14
- package/dist/domain/javascript/javascriptSemanticGraph.js +5 -1
- package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +0 -1
- package/dist/domain/javascript/javascriptSemanticIterationSources.js +2 -2
- package/dist/domain/javascript/javascriptSemanticMemberMutations.js +224 -91
- package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +199 -3
- package/dist/domain/javascript/javascriptSemanticObjectReferences.js +333 -43
- package/dist/domain/javascript/javascriptSemanticObjects.js +20 -16
- package/dist/domain/javascript/javascriptSemanticProjection.js +151 -43
- package/dist/domain/javascript/javascriptSemanticPromises.js +6 -9
- package/dist/domain/javascript/javascriptSemanticProvenance.js +5 -1
- package/dist/domain/javascript/javascriptSemanticQuery.js +7 -2
- package/dist/domain/javascript/javascriptSemanticReferenceSources.js +25 -0
- package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +331 -8
- package/dist/domain/javascript/javascriptSemanticResources.js +6 -40
- package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +14 -0
- package/dist/domain/javascript/javascriptSemanticReturns.js +37 -30
- package/dist/domain/javascript/javascriptSemanticState.js +39 -2
- package/dist/domain/javascript/javascriptSemanticTraversal.js +6 -4
- package/dist/domain/javascript/javascriptSemanticValues.js +227 -30
- package/dist/domain/javascript/javascriptSourceMapPaths.js +44 -17
- package/dist/domain/javascript/javascriptSourceParser.js +72 -3
- package/dist/domain/javascript/javascriptSourceSelection.js +11 -0
- package/dist/domain/javascript/javascriptStaticAnalysis.js +51 -17
- package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +97 -23
- package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +224 -44
- package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +166 -56
- package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
- package/dist/domain/javascript/javascriptStaticAnalysisTypes.js +2 -1
- package/dist/domain/javascript/javascriptSymbolicBindings.js +836 -0
- package/dist/domain/javascript/javascriptSymbolicControlFlow.js +40 -0
- package/dist/domain/javascript/javascriptSymbolicValues.js +34 -0
- package/dist/domain/javascript/sourceToBundleComparison.js +3 -1
- package/dist/domain/javascript/sourceToBundleComparisonSchemas.js +2 -0
- package/dist/domain/javascript/sourceToBundleSignals.js +47 -13
- package/dist/domain/jsonValue.js +37 -12
- package/dist/domain/localPath.js +6 -3
- package/dist/domain/managed/managedApplicationGraph.js +5 -0
- package/dist/domain/managed/managedApplicationGraphCoverage.js +6 -2
- package/dist/domain/managed/managedApplicationGraphNodes.js +0 -1
- package/dist/domain/managed/managedArtifact.js +51 -1
- package/dist/domain/managed/managedInspectionEvidence.js +5 -6
- package/dist/domain/managed/managedMemberComparison.js +3 -0
- package/dist/domain/managed/managedMemberComparisonCoverage.js +23 -3
- package/dist/domain/managed/managedMemberComparisonItems.js +23 -19
- package/dist/domain/managed/managedMemberComparisonMatch.js +209 -18
- package/dist/domain/managed/managedNativeVerificationMatch.js +49 -26
- package/dist/domain/managed/managedNativeVerificationSchemas.js +13 -2
- package/dist/domain/managed/managedReconstruction.js +5 -8
- package/dist/domain/mobileApplicationGraphProjection.js +80 -0
- package/dist/domain/native/addressCoordinate.js +11 -0
- package/dist/domain/native/binaryLayout.js +2 -4
- package/dist/domain/native/bytePattern.js +100 -0
- package/dist/domain/native/nativeAotPe.js +2 -2
- package/dist/domain/native/nativeInspection.js +38 -4
- package/dist/domain/native/nativeInstruction.js +17 -2
- package/dist/domain/native/nativeInvestigationGraph.js +9 -5
- package/dist/domain/native/nativeLoadImage.js +19 -1
- package/dist/domain/native/nativeUiObservation.js +5 -6
- package/dist/domain/native/objcSwiftMetadata.js +4 -1
- package/dist/domain/native/peResources.js +8 -2
- package/dist/domain/native/recordedCrash.js +79 -10
- package/dist/domain/offsetDateTime.js +60 -0
- package/dist/domain/pcap/pcapAnalysis.js +91 -0
- package/dist/domain/pcap/pcapEvidence.js +15 -0
- package/dist/domain/peMachine.js +36 -0
- package/dist/domain/pngHeader.js +18 -0
- package/dist/domain/process/processCaptureCoverage.js +26 -3
- package/dist/domain/process/processCaptureExample.js +2 -0
- package/dist/domain/process/processCaptureValidation.js +33 -8
- package/dist/domain/process/processComparison.js +41 -13
- package/dist/domain/process/processScenario.js +7 -0
- package/dist/domain/process/processTraceEvaluation.js +54 -50
- package/dist/domain/process/processTraceSpecification.js +243 -89
- package/dist/domain/propertyListKeys.js +211 -11
- package/dist/domain/propertyListXmlText.js +20 -4
- package/dist/domain/providerAdapterError.js +0 -5
- package/dist/domain/providerConfigurationRefusal.js +12 -0
- package/dist/domain/providerSelectionError.js +2 -1
- package/dist/domain/qlogCapture.js +62 -0
- package/dist/domain/rawBinary.js +96 -0
- package/dist/domain/reconstructionCoverage.js +5 -1
- package/dist/domain/reconstructionCoverageEvaluation.js +18 -15
- package/dist/domain/reconstructionCoverageVerifierResults.js +35 -0
- package/dist/domain/reconstructionObligationLedgerIntegrity.js +114 -0
- package/dist/domain/reconstructionObligationLedgerSchemas.js +104 -1
- package/dist/domain/reconstructionReadiness.js +4 -8
- package/dist/domain/reconstructionReadinessJourneyFindings.js +4 -1
- package/dist/domain/reconstructionUnknowns.js +9 -1
- package/dist/domain/reconstructionVerification.js +54 -25
- package/dist/domain/recordedTransportUrl.js +59 -0
- package/dist/domain/referenceSourceClassification.js +27 -23
- package/dist/domain/referenceSourceGraph.js +51 -13
- package/dist/domain/referenceSourceImportParsing.js +23 -13
- package/dist/domain/referenceSourcePathIdentity.js +11 -1
- package/dist/domain/referenceSourceRequireBindings.js +5 -12
- package/dist/domain/referenceSourceSummary.js +92 -0
- package/dist/domain/relationshipCoverage.js +44 -0
- package/dist/domain/residualUnknown.js +93 -26
- package/dist/domain/reverseEngineering.js +31 -0
- package/dist/domain/runtimeVersion.js +8 -0
- package/dist/domain/rust/rustBinary.js +200 -0
- package/dist/domain/signals/annotationTextWindow.js +31 -0
- package/dist/domain/signals/signalDecoders.js +69 -0
- package/dist/domain/signals/signalRecording.js +115 -0
- package/dist/domain/sourceMapContents.js +10 -3
- package/dist/domain/sourceMapEnvelope.js +17 -11
- package/dist/domain/sqlite/sqliteDatabase.js +188 -0
- package/dist/domain/staticRuntimeCorrelation.js +7 -9
- package/dist/domain/swiftSymbolClassification.js +17 -0
- package/dist/domain/symbolAnalysis.js +16 -4
- package/dist/domain/urlComponents.js +6 -0
- package/dist/domain/wasm/wasmArtifact.js +119 -0
- package/dist/domain/wasm/wasmInterface.js +89 -0
- package/dist/domain/webBundleAnalysis.js +14 -3
- package/dist/domain/webBundleAnalyzerAst.js +7 -2
- package/dist/domain/webBundleAnalyzerInspection.js +54 -38
- package/dist/domain/webBundleAnalyzerResult.js +18 -6
- package/dist/domain/webCaptureDiff.js +140 -39
- package/dist/domain/webCaptureFrameComparison.js +49 -0
- package/dist/domain/webMcpDiscovery.js +5 -2
- package/dist/domain/webModuleImports.js +22 -27
- package/dist/domain/webModuleTrace.js +3 -8
- package/dist/domain/webNetworkCapture.js +101 -39
- package/dist/domain/webNetworkCaptureCoordinates.js +21 -0
- package/dist/domain/webRuntime.js +0 -1
- package/dist/domain/webScreenshot.js +2 -2
- package/dist/domain/webScriptArtifacts.js +2 -4
- package/dist/domain/webScriptExport.js +6 -8
- package/dist/domain/webScriptExportPlan.js +2 -2
- package/dist/domain/webSourceLocation.js +20 -9
- package/dist/domain/zipPackageFormat.js +29 -3
- package/dist/dotnet/ManagedArtifactInspector.js +27 -12
- package/dist/dotnet/ManagedDecodeBudget.js +66 -8
- package/dist/dotnet/ManagedMemberInspector.js +101 -21
- package/dist/dotnet/ManagedMemberInspectorCore.js +356 -140
- package/dist/dotnet/ManagedMemberInstructionDecoder.js +109 -37
- package/dist/dotnet/ManagedMemberOwnership.js +65 -0
- package/dist/dotnet/ManagedMemberPointers.js +69 -0
- package/dist/dotnet/ManagedMemberRows.js +179 -46
- package/dist/dotnet/ManagedMetadataHeaps.js +110 -24
- package/dist/dotnet/ManagedMetadataInventory.js +5 -5
- package/dist/dotnet/ManagedMetadataInventoryRows.js +36 -52
- package/dist/dotnet/ManagedMetadataLayout.js +9 -1
- package/dist/dotnet/ManagedMetadataRowSizes.js +1 -1
- package/dist/dotnet/ManagedMethodBodyReader.js +29 -11
- package/dist/dotnet/ManagedMethodSpecs.js +78 -0
- package/dist/dotnet/ManagedNativeBoundaryHelpers.js +2 -2
- package/dist/dotnet/ManagedNativeBoundaryInspector.js +6 -13
- package/dist/dotnet/ManagedPeReader.js +55 -27
- package/dist/dotnet/ManagedReaderFailure.js +9 -0
- package/dist/dotnet/ManagedSnapshot.js +88 -0
- package/dist/dotnet/ManagedStaticProvider.js +55 -64
- package/dist/dotnet/ManagedTypeMemberLists.js +105 -0
- package/dist/dotnet/ManagedTypeNames.js +98 -0
- package/dist/dotnet/ManagedUserStrings.js +75 -0
- package/dist/electron/ElectronFusePath.js +247 -0
- package/dist/electron/ElectronFuseProvider.js +113 -0
- package/dist/electron/ElectronFuseReader.js +317 -0
- package/dist/evaluation/AgentEvaluationFixtures.js +194 -11
- package/dist/evaluation/CodexAgentEval.js +19 -40
- package/dist/evaluation/KnownAnswerEvaluation.js +126 -57
- package/dist/evm/EvmoleFailures.js +19 -14
- package/dist/evm/EvmoleInterfaceAdapter.js +5 -1
- package/dist/evm/EvmoleInterfaceProvider.js +141 -31
- package/dist/evm/EvmoleInterfaceWorker.js +2 -0
- package/dist/evm/SolidityMetadata.js +139 -0
- package/dist/filesystem/OwnedStagedOutput.js +138 -0
- package/dist/filesystem/RegularFile.js +48 -4
- package/dist/filesystem/readFileHandleChunks.js +17 -8
- package/dist/firmware/FirmwareCommand.js +2 -2
- package/dist/firmware/FirmwareFiles.js +8 -12
- package/dist/firmware/FirmwareProvider.js +2 -0
- package/dist/firmware/FirmwarePublication.js +218 -1
- package/dist/firmware/FirmwareReports.js +202 -12
- package/dist/flutter/DartElf.js +418 -0
- package/dist/flutter/ElfBuildId.js +137 -0
- package/dist/flutter/ElfLoadMap.js +91 -0
- package/dist/flutter/FlutterBuildProvider.js +826 -0
- package/dist/flutter/FlutterPayloadScan.js +180 -0
- package/dist/frida/FridaInstrumentationManager.js +1104 -0
- package/dist/gdb/GdbSessionManager.js +1451 -0
- package/dist/generatedPackageMetadata.js +2 -2
- package/dist/ghidra/GhidraAnalysisProfile.js +130 -12
- package/dist/ghidra/GhidraClient.js +195 -88
- package/dist/ghidra/GhidraDiagnostics.js +7 -0
- package/dist/ghidra/GhidraDoctor.js +15 -12
- package/dist/ghidra/GhidraFunctionValues.js +49 -2
- package/dist/ghidra/GhidraInstallation.js +215 -19
- package/dist/ghidra/GhidraInstallationPolicy.js +79 -29
- package/dist/ghidra/GhidraInventoryValues.js +30 -0
- package/dist/ghidra/GhidraJavaLaunch.js +91 -10
- package/dist/ghidra/GhidraJavaProperties.js +117 -0
- package/dist/ghidra/GhidraLanguageCatalog.js +74 -4
- package/dist/ghidra/GhidraLauncher.js +234 -57
- package/dist/ghidra/GhidraLoadImageAttest.js +28 -8
- package/dist/ghidra/GhidraLoadImageValues.js +72 -0
- package/dist/ghidra/GhidraMipsProfile.js +250 -14
- package/dist/ghidra/GhidraPeProfile.js +21 -0
- package/dist/ghidra/GhidraPowerPcProfile.js +51 -0
- package/dist/ghidra/GhidraProvider.js +54 -16
- package/dist/ghidra/GhidraProviderCapabilities.js +13 -12
- package/dist/ghidra/GhidraProviderClient.js +260 -57
- package/dist/ghidra/GhidraPspExtension.js +140 -0
- package/dist/ghidra/GhidraPspProfile.js +59 -0
- package/dist/ghidra/GhidraRawBinaryLanguage.js +40 -0
- package/dist/ghidra/GhidraRiscvProfile.js +100 -0
- package/dist/ghidra/GhidraSessionError.js +155 -11
- package/dist/ghidra/GhidraSessionValues.js +66 -0
- package/dist/ghidra/GhidraTransport.js +2 -1
- package/dist/go/GoBinaryContainer.js +140 -0
- package/dist/go/GoBinaryImage.js +210 -0
- package/dist/go/GoBinaryProvider.js +151 -0
- package/dist/go/GoElfImage.js +211 -0
- package/dist/go/GoMachoImage.js +164 -0
- package/dist/go/GoModuleText.js +217 -0
- package/dist/go/GoPeImage.js +124 -0
- package/dist/hopper/BridgeLauncher.js +35 -2
- package/dist/hopper/HopperAnalysisProfile.js +21 -11
- package/dist/hopper/HopperCleanup.js +15 -3
- package/dist/hopper/HopperClient.js +188 -36
- package/dist/hopper/HopperMacPublisher.js +29 -0
- package/dist/hopper/HopperMachOImage.js +61 -29
- package/dist/hopper/HopperProcessDiagnostic.js +27 -0
- package/dist/hopper/HopperProvider.js +59 -28
- package/dist/hopper/HopperProviderCapabilities.js +7 -3
- package/dist/hopper/HopperRequestQueue.js +17 -5
- package/dist/hopper/HopperSessionValues.js +10 -1
- package/dist/hopper/HopperTargetLease.js +66 -19
- package/dist/ida/IdaBusyHealth.js +44 -0
- package/dist/ida/IdaCallGraph.js +134 -0
- package/dist/ida/IdaConfiguration.js +7 -2
- package/dist/ida/IdaDiagnosticRedactor.js +199 -0
- package/dist/ida/IdaDiagnosticWriter.js +62 -0
- package/dist/ida/IdaDoctor.js +7 -5
- package/dist/ida/IdaJsonDiagnostic.js +138 -0
- package/dist/ida/IdaMcpConnection.js +297 -27
- package/dist/ida/IdaNativeProtocol.js +93 -0
- package/dist/ida/IdaOperationRunner.js +246 -43
- package/dist/ida/IdaProtocolValues.js +86 -4
- package/dist/ida/IdaProvider.js +29 -10
- package/dist/ida/IdaProviderCapabilities.js +37 -8
- package/dist/ida/IdaSessionClient.js +331 -54
- package/dist/ida/IdaWorkspace.js +54 -6
- package/dist/inspector/V8InspectorCaptureProjection.js +7 -2
- package/dist/inspector/V8InspectorEndpoint.js +15 -13
- package/dist/inspector/V8InspectorProvider.js +41 -7
- package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +19 -8
- package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +103 -29
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +6 -4
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +78 -9
- package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +15 -5
- package/dist/javascript/recovery/RecoveryFiles.js +51 -6
- package/dist/javascript/recovery/WakaruExecution.js +19 -11
- package/dist/javascript/recovery/WakaruProvider.js +12 -9
- package/dist/javascript/recovery/WakaruPublication.js +24 -10
- package/dist/javascript/recovery/WakaruRelease.js +1 -1
- package/dist/javascript/recovery/WakaruReport.js +3 -2
- package/dist/javascript/sourceMaps/DecodedSourceMap.js +2 -16
- package/dist/javascript/sourceMaps/SourceMapCommand.js +22 -4
- package/dist/javascript/sourceMaps/SourceMapDecoder.js +22 -4
- package/dist/javascript/sourceMaps/SourceMapFormat.js +25 -38
- package/dist/javascript/sourceMaps/TraceSourceMap.js +34 -6
- package/dist/jeb/JebMcpConnection.js +19 -12
- package/dist/jeb/JebMcpEndpoint.js +6 -1
- package/dist/jeb/JebProvider.js +5 -7
- package/dist/logger.js +14 -1
- package/dist/main/shutdown.js +3 -0
- package/dist/main/transport.js +48 -4
- package/dist/main.js +14 -3
- package/dist/mcp/AnalysisSnapshotFiles-BAbiJQOc.js +1412 -0
- package/dist/mcp/ArtifactProvider-DViCU_rn.js +2183 -0
- package/dist/mcp/ArtifactProviderMetadata-b7pOK5_t.js +76 -0
- package/dist/mcp/ArtifactReader-OyM03Gjn.js +55 -0
- package/dist/mcp/ArtifactResourceScope-P3tq5z8Z.js +162 -0
- package/dist/mcp/AsarHeader-WsPgoooH.js +31 -0
- package/dist/mcp/BinarySessionStatus-B4P9gf-S.js +212 -0
- package/dist/mcp/BinaryTargetResolver-BMaE_0H1.js +1427 -0
- package/dist/mcp/BoundedFileBytes-DuczXiQZ.js +68 -0
- package/dist/mcp/CdpCaptureDocuments-HDiF2O7k.js +746 -0
- package/dist/mcp/CdpCaptureValues-M-j6CIh1.js +90 -0
- package/dist/mcp/CdpConnection-BpDfz4MK.js +570 -0
- package/dist/mcp/CdpOptionalCommand-BPjRD9Kz.js +120 -0
- package/dist/mcp/CdpTargetSession-BsPoKhEU.js +86 -0
- package/dist/mcp/DirectAnalysis-DrafbXke.js +409 -0
- package/dist/mcp/DirectAnalysisStatus-CjjeDLzW.js +44 -0
- package/dist/mcp/ElectronFileScope-BPG_YoyU.js +110 -0
- package/dist/mcp/InterfaceBuilderDecodeBudget-5F2AkxJT.js +652 -0
- package/dist/mcp/ManagedStaticProvider-BthZbKyZ.js +5028 -0
- package/dist/mcp/NativeMacOSProvider-Bh79k8dI.js +4867 -0
- package/dist/mcp/NativeMacOSProviderMetadata-N1lPOaY_.js +307 -0
- package/dist/mcp/ProcedureAddressResolution-CQpuwm1h.js +19 -0
- package/dist/mcp/ProcessOwnership-Bl_3ejLe.js +1502 -0
- package/dist/mcp/ProviderDeadline-DskQ94YD.js +932 -0
- package/dist/mcp/WorkflowEvidence-umWrB_wm.js +111 -0
- package/dist/mcp/analysisErrorCore-DXRTvF_m.js +235 -0
- package/dist/mcp/analysisErrorProjection-BN0EPM-3.js +892 -0
- package/dist/mcp/artifactOperationError-CkHMMaf7.js +27 -0
- package/dist/mcp/artifactToolContracts-Di4qZlEt.js +72 -0
- package/dist/mcp/browserObservation-C0s4i8UI.js +4468 -0
- package/dist/mcp/browserObservationError-CyLugqX4.js +40 -0
- package/dist/mcp/browserObservationSchemas-tgqjH7aA.js +573 -0
- package/dist/mcp/browserScenario-CAQ8Fns9.js +2929 -0
- package/dist/mcp/browserScenarioCapture-CTNFN-FI.js +479 -0
- package/dist/mcp/canonicalDigest-Bi_0_zGi.js +71 -0
- package/dist/mcp/digests-BFoWUT_-.js +223 -0
- package/dist/mcp/electronActiveObservation-lDvQTMR0.js +226 -0
- package/dist/mcp/electronObservation-DFOFEood.js +112 -0
- package/dist/mcp/electronObservation-i7LcILQ-.js +562 -0
- package/dist/mcp/electronScenario-nCzE6IfJ.js +653 -0
- package/dist/mcp/emptyArraySchema-tL6Qymyd.js +140 -0
- package/dist/mcp/enhancedInputs-DgdEnzHy.js +56 -0
- package/dist/mcp/javascriptRuntimeObservation-61NhCf7H.js +690 -0
- package/dist/mcp/javascriptRuntimeObservation-PIUoLfX6.js +121 -0
- package/dist/mcp/jsonSerialization-V-wWiFRE.js +152 -0
- package/dist/mcp/lipo-Bnkoq_6W.js +502 -0
- package/dist/mcp/localPath-AxvW9aPe.js +19 -0
- package/dist/mcp/logger-BQY5ulYv.js +48 -0
- package/dist/mcp/main-kBXHZ8S5.js +69390 -0
- package/dist/mcp/main.js +6 -0
- package/dist/mcp/managedToolContracts-CK--I_s7.js +101 -0
- package/dist/mcp/nativeValueTrace-DR9UE62L.js +3439 -0
- package/dist/mcp/officialToolContracts-B67NJ2tC.js +1413 -0
- package/dist/mcp/pngHeader-DQ-ObyY2.js +147 -0
- package/dist/mcp/propertyListKeys-DD25WsjI.js +553 -0
- package/dist/mcp/providerAdapterError-sDxToNal.js +25 -0
- package/dist/mcp/providerIdentities--ptAh481.js +31 -0
- package/dist/mcp/providerIdentity-BCQ5n5tw.js +16 -0
- package/dist/mcp/providerOperationHealth-CTYa3iLf.js +48 -0
- package/dist/mcp/rolldown-runtime-BjeaiXFo.js +121 -0
- package/dist/mcp/safeJson-NeGfpkrI.js +25 -0
- package/dist/mcp/scanCanonical-CRXSpule.js +3982 -0
- package/dist/mcp/serverIdentity-Cio4iFV3.js +1328 -0
- package/dist/mcp/sourceMapEnvelope-C0uJlrOh.js +94 -0
- package/dist/mcp/toolContracts-BW05wpcr.js +12200 -0
- package/dist/mcp/toolOutputSchemaGroups-ColvNZ1r.js +17533 -0
- package/dist/mcp/unicodeCodePointOrder-BezCbTpg.js +26 -0
- package/dist/mcp/webContentArtifact-Dzjc1z-R.js +284 -0
- package/dist/mcp/webRuntime-K__NYzXm.js +74 -0
- package/dist/mcp/webSourceLocation-DbMAT2J9.js +11130 -0
- package/dist/mcpDoctor.js +93 -70
- package/dist/mcpStartupPolicy.js +3 -0
- package/dist/native/AppleDispatchCoverage.js +57 -17
- package/dist/native/AppleDispatchMetadata.js +6 -2
- package/dist/native/AppleMachoFixups.js +188 -25
- package/dist/native/AppleMachoSelection.js +30 -23
- package/dist/native/AppleObjcCategories.js +1 -2
- package/dist/native/AppleObjcDispatchFacets.js +76 -7
- package/dist/native/CommandRunner.js +142 -32
- package/dist/native/LldbCallTracer.js +5 -3
- package/dist/native/MachoArchitectureSelection.js +50 -0
- package/dist/native/NativeCallObservation.js +2 -1
- package/dist/native/NativeMacOSProvider.js +90 -29
- package/dist/native/NativeMachoInspection.js +136 -76
- package/dist/native/NativeUiObservation.js +2 -2
- package/dist/native/SignatureTargetBinding.js +118 -55
- package/dist/native/parsers/codesign.js +27 -10
- package/dist/native/parsers/demangle.js +7 -1
- package/dist/native/parsers/dyldInfo.js +73 -4
- package/dist/native/parsers/lipo.js +53 -19
- package/dist/native/parsers/machoUuid.js +150 -0
- package/dist/native/parsers/otool.js +232 -29
- package/dist/native/pe/PeResourcesProvider.js +20 -6
- package/dist/native/pwndbg/PwndbgCoreContext.js +20 -20
- package/dist/native/pwntools/PwntoolsDecoder.js +264 -40
- package/dist/native/pwntools/PwntoolsFailures.js +2 -1
- package/dist/native/pwntools/PwntoolsInputLimit.js +27 -0
- package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +27 -15
- package/dist/native/pwntools/PwntoolsResourceLimits.js +3 -3
- package/dist/native/pwntools/RecordedCrashSourceBindings.js +12 -8
- package/dist/native/pwntools/RecordedCrashStructureBindings.js +3 -1
- package/dist/objdump/ObjdumpCommand.js +21 -0
- package/dist/pcap/PcapCommand.js +146 -0
- package/dist/pcap/PcapConfiguration.js +93 -0
- package/dist/pcap/PcapNativeBound.js +58 -0
- package/dist/pcap/PcapOutput.js +240 -0
- package/dist/pcap/PcapProvider.js +424 -0
- package/dist/pcap/PcapSnapshot.js +171 -0
- package/dist/process/ArtifactAnalysisResources.js +213 -0
- package/dist/process/CurrentEntrypointPath.js +6 -0
- package/dist/process/DarwinProcessRunTokenReader.js +117 -13
- package/dist/process/ExecFileBoundedOutput.js +44 -0
- package/dist/process/ExecFileOutput.js +30 -6
- package/dist/process/JavaScriptWorkerMemoryLimit.js +25 -0
- package/dist/process/LinuxResourceLimits.js +80 -0
- package/dist/process/MacCodeSignature.js +3 -0
- package/dist/process/OwnedCommand.js +37 -13
- package/dist/process/PrivateRuntimeRoot.js +9 -19
- package/dist/process/PrivateRuntimeRootUnavailableError.js +10 -0
- package/dist/process/ProcessOwnership.js +70 -17
- package/dist/process/ProcessOwnershipObservation.js +35 -4
- package/dist/process/ProviderDeadline.js +58 -12
- package/dist/process/ProviderProcess.js +108 -11
- package/dist/process/WindowsAuthority.js +48 -39
- package/dist/process/WindowsBatchCommand.js +46 -0
- package/dist/process/boundedUtf8Text.js +13 -0
- package/dist/process/capture/FilesystemSnapshot.js +60 -9
- package/dist/process/capture/ProcessCaptureClock.js +2 -0
- package/dist/process/capture/ProcessCaptureError.js +22 -3
- package/dist/process/capture/ProcessCaptureJournal.js +2 -1
- package/dist/process/capture/ProcessCaptureLifecycle.js +87 -36
- package/dist/process/capture/ProcessCaptureProgress.js +2 -1
- package/dist/process/capture/ProcessHarness.js +17 -14
- package/dist/process/capture/ProcessNormalization.js +278 -36
- package/dist/process/capture/ProcessSampling.js +3 -2
- package/dist/process/capture/ProcessScenarioRuntimeValidation.js +13 -13
- package/dist/process/capture/TerminalRenderer.js +31 -10
- package/dist/process/ownedDebuggerSession.js +203 -0
- package/dist/reference/ReferenceSourceReader.js +0 -1
- package/dist/reference/ReferenceSourceReaderEntries.js +68 -54
- package/dist/reference/ReferenceSourceReaderErrors.js +5 -1
- package/dist/reference/ReferenceSourceReaderFile.js +0 -1
- package/dist/reference/ReferenceSourceReaderTypes.js +1 -2
- package/dist/reference/ReferenceSourceReaderValidate.js +0 -1
- package/dist/rizin/RizinCommand.js +14 -0
- package/dist/rizin/RizinDebugSessionManager.js +1072 -0
- package/dist/rust/RustAuditableReader.js +309 -0
- package/dist/rust/RustBinaryImage.js +116 -0
- package/dist/rust/RustBinaryProvider.js +162 -0
- package/dist/server/EvidenceMcpServer.js +160 -37
- package/dist/server/admittedToolOperation.js +7 -2
- package/dist/server/contractToolHandler.js +8 -1
- package/dist/server/createServer.js +157 -27
- package/dist/server/externalMutationAdmission.js +50 -0
- package/dist/server/mcpProgress.js +4 -2
- package/dist/server/promptCompletion.js +19 -6
- package/dist/server/providerEnvironment.js +3 -0
- package/dist/server/registerAnalysisViewTool.js +6 -2
- package/dist/server/registerAndroidTools.js +22 -4
- package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +8 -1
- package/dist/server/registerArtifactTools.js +21 -1
- package/dist/server/registerBrowserTools.js +2 -4
- package/dist/server/registerBundleComparisonTool.js +4 -4
- package/dist/server/registerCaptureTools.js +12 -0
- package/dist/server/registerCutterTools.js +33 -0
- package/dist/server/registerElectronTools.js +12 -9
- package/dist/server/registerEnhancedTools.js +7 -6
- package/dist/server/registerEvidenceTools.js +14 -10
- package/dist/server/registerEvmTools.js +22 -4
- package/dist/server/registerFlutterTools.js +17 -0
- package/dist/server/registerFridaTools.js +205 -0
- package/dist/server/registerFunctionComparisonTool.js +29 -9
- package/dist/server/registerGdbTools.js +64 -0
- package/dist/server/registerGoTools.js +9 -0
- package/dist/server/registerInvestigationTools/helpers.js +2 -2
- package/dist/server/registerInvestigationTools.js +12 -8
- package/dist/server/registerJavaScriptRuntimeObservationTools.js +1 -5
- package/dist/server/registerManagedTools.js +11 -1
- package/dist/server/registerNativeTools.js +14 -0
- package/dist/server/registerOfficialTools.js +5 -0
- package/dist/server/registerPcapTools.js +35 -0
- package/dist/server/registerProcessComparisonTool.js +9 -2
- package/dist/server/registerReverseEngineeringTools.js +86 -0
- package/dist/server/registerRizinDebugTools.js +53 -0
- package/dist/server/registerRustTools.js +9 -0
- package/dist/server/registerSessionRecordTools.js +19 -13
- package/dist/server/registerSessionStatusTool.js +22 -4
- package/dist/server/registerSessionTools.js +29 -16
- package/dist/server/registerSignalTools.js +12 -0
- package/dist/server/registerSqliteTools.js +9 -0
- package/dist/server/registerWasmTools.js +46 -0
- package/dist/server/registerWebNetworkCaptureTool.js +24 -10
- package/dist/server/retainedSummaryDelivery.js +28 -0
- package/dist/server/sessionAvailabilityPolicy.js +3 -0
- package/dist/server/toolRegistrationOptions.js +8 -0
- package/dist/server/toolResult.js +52 -19
- package/dist/server/toolResultEncoding.js +36 -3
- package/dist/serverIdentity.js +17 -8
- package/dist/signals/SigrokRecordingProvider.js +339 -0
- package/dist/signals/parseDecoderDiscovery.js +65 -0
- package/dist/sqlite/SqliteDatabaseFailures.js +134 -0
- package/dist/sqlite/SqliteDatabaseInspection.js +421 -0
- package/dist/sqlite/SqliteDatabaseLimits.js +16 -0
- package/dist/sqlite/SqliteDatabaseProvider.js +295 -0
- package/dist/sqlite/SqliteDatabaseSnapshot.js +156 -0
- package/dist/sqlite/SqliteDatabaseWorker.js +46 -0
- package/dist/sqlite/SqliteDatabaseWorkerExecution.js +112 -0
- package/dist/wasm/WabtArtifactProvider.js +336 -0
- package/dist/wasm/WabtFailures.js +101 -0
- package/dist/wasm/WabtInterface.js +309 -0
- package/dist/wasm/WabtOutput.js +60 -0
- package/dist/wasm/WabtRelease.js +12 -0
- package/dist/wasm/WabtString.js +48 -0
- package/dist/wasm/WabtWat.js +147 -0
- package/dist/wasm/WasmGlueAdapter.js +53 -0
- package/dist/wasm/WasmInterfaceBudget.js +11 -0
- package/dist/windows/WindowsNativeLoader.js +37 -7
- package/dist/windows/WindowsOwnedProcess.js +150 -17
- package/dist/windows/WindowsPrivateRuntime.js +22 -1
- package/install.sh +157 -98
- package/licenses/Apache-2.0.txt +202 -0
- package/licenses/GCC-Runtime-Library-Exception-3.1.txt +73 -0
- package/licenses/GPL-3.0.txt +674 -0
- package/licenses/LGPL-2.0.txt +480 -0
- package/licenses/MIT-template.txt +18 -0
- package/licenses/MinGW-w64-runtime.txt +240 -0
- package/licenses/Node-22.19.0-LICENSE.txt +2666 -0
- package/licenses/README.md +68 -0
- package/licenses/cfworker-MIT.txt +21 -0
- package/licenses/dotnet-runtime-MIT.txt +23 -0
- package/licenses/frida-17.23.2-COPYING.txt +50 -0
- package/licenses/ghidra-12.1.4-DISCLAIMER.txt +13 -0
- package/licenses/ghidra-12.1.4-LICENSE.txt +201 -0
- package/licenses/ghidra-12.1.4-NOTICE.txt +49 -0
- package/licenses/npm-dependencies.txt +3612 -0
- package/licenses/npm-runtime-notices.txt +8548 -0
- package/licenses/upstream-sources.json +72 -0
- package/licenses/xterm-MIT.txt +21 -0
- package/native/windows/README.md +92 -11
- package/native/windows/build/manifest.json +2 -2
- package/native/windows/build/rea-windows-x64.node +0 -0
- package/package.json +89 -22
- package/scripts/electron-active-hook.cjs +4 -1
- package/scripts/hopper-demo-x11.py +53 -3
- package/scripts/prepack.mjs +5 -0
- package/scripts/rea-android-workspace-guardian.mjs +46 -0
- package/scripts/rea.mjs +28 -12
- package/scripts/verify-windows-native-artifact.mjs +2 -2
- package/skills/reverse-engineer-anything/SKILL.md +131 -10
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +10 -10
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +23 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +28 -2
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +125 -15
- package/skills/reverse-engineer-anything/references/runtime-observation.md +57 -7
- package/third_party/README.md +1 -1
- package/third_party/wabt/README.md +24 -0
- package/dist/browser/history/HarCaptureAdapter.js +0 -20
- package/dist/cli/streamedJsonOutput.js +0 -135
- /package/dist/{application/binary → process}/AbortablePromise.js +0 -0
|
@@ -0,0 +1,4185 @@
|
|
|
1
|
+
import { __esmMin } from "./rolldown-runtime-DXoylpqc.js";
|
|
2
|
+
import { AnalysisCancelledError, AnalysisError, AnalysisResourceConstraintError, init_analysisErrorBase, init_analysisErrorCore } from "./errorSchemas-CTRmvMl3.js";
|
|
3
|
+
import { ArtifactReaderFailure, init_ArtifactReader } from "./ArtifactReader-BXkffc1D.js";
|
|
4
|
+
import { RegularFileChangedError, init_RegularFile } from "./RegularFile-B_6KPCNQ.js";
|
|
5
|
+
import { EvidenceIntegrityError, init_evidenceErrors } from "./analysisErrorPresentation-DGt7TdsH.js";
|
|
6
|
+
import { analysisErrorWithCleanupFailure, init_analysisErrorCleanup } from "./analysisErrorCleanup-Do6YeeoD.js";
|
|
7
|
+
import { ProviderCleanupError, init_providerCleanupError } from "./providerCleanupError-Ceq8f0wK.js";
|
|
8
|
+
import { MANAGED_STATIC_PROVIDER, init_InvestigationProviders } from "./InvestigationProviders-DoQRIHii.js";
|
|
9
|
+
import { init_BoundedFileBytes, readBoundedFileBytes } from "./BoundedFileBytes-BU30odTm.js";
|
|
10
|
+
import { RegularFileCleanupFailure, init_RegularFileRead, withRegularFile } from "./RegularFileRead-DVlC5faM.js";
|
|
11
|
+
import { init_managedArtifact, managedMemberInspectionSchema } from "./managedApplicationGraph-B08jb3jq.js";
|
|
12
|
+
import { classifyBinaryTargetFilesystemFailure, decodePeMachine, init_BinaryTargetResolver, init_peMachine } from "./BinaryTargetResolver-CVIJ_s1A.js";
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
14
|
+
|
|
15
|
+
//#region dist/dotnet/ManagedReaderFailure.js
|
|
16
|
+
var ManagedReaderFailure, managedFailure, readManagedValue, uniqueManagedParseIssues, appendManagedParseIssues;
|
|
17
|
+
function init_ManagedReaderFailure() {
|
|
18
|
+
return (init_ManagedReaderFailure = __esmMin((() => {
|
|
19
|
+
ManagedReaderFailure = class extends Error {
|
|
20
|
+
issue;
|
|
21
|
+
constructor(issue, options) {
|
|
22
|
+
super(issue.detail, options);
|
|
23
|
+
this.issue = issue;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
managedFailure = (code, scope, detail, offset = null) => new ManagedReaderFailure({
|
|
27
|
+
code,
|
|
28
|
+
scope,
|
|
29
|
+
offset,
|
|
30
|
+
detail
|
|
31
|
+
});
|
|
32
|
+
readManagedValue = (operation, issues) => {
|
|
33
|
+
try {
|
|
34
|
+
return operation();
|
|
35
|
+
} catch (cause) {
|
|
36
|
+
if (!(cause instanceof ManagedReaderFailure) || cause.issue.code === "resource-limit") throw cause;
|
|
37
|
+
issues.push(cause.issue);
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
uniqueManagedParseIssues = (issues) => [...new Map(issues.map((issue) => [JSON.stringify(issue), issue])).values()];
|
|
42
|
+
appendManagedParseIssues = (issues, ...found) => {
|
|
43
|
+
for (const list of found) for (const issue of list) issues.push(issue);
|
|
44
|
+
};
|
|
45
|
+
})))();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region dist/dotnet/ManagedDecodeBudget.js
|
|
50
|
+
var MAX_METADATA_REPRESENTATION_BYTES, ManagedDecodeBudget, budgets, attachManagedDecodeBudget, managedDecodeBudget, managedJsonStringBytes, jsonBytes, admitManagedProjection;
|
|
51
|
+
function init_ManagedDecodeBudget() {
|
|
52
|
+
return (init_ManagedDecodeBudget = __esmMin((() => {
|
|
53
|
+
init_ManagedReaderFailure();
|
|
54
|
+
MAX_METADATA_REPRESENTATION_BYTES = 64 * 1024 * 1024;
|
|
55
|
+
ManagedDecodeBudget = class {
|
|
56
|
+
#remaining = MAX_METADATA_REPRESENTATION_BYTES;
|
|
57
|
+
#transient = 0;
|
|
58
|
+
#rows = new Map();
|
|
59
|
+
#strings = new Map();
|
|
60
|
+
#digests = new WeakMap();
|
|
61
|
+
reserve(bytes, offset) {
|
|
62
|
+
this.#admit(bytes, offset);
|
|
63
|
+
this.#remaining -= bytes;
|
|
64
|
+
}
|
|
65
|
+
/** Retain one bookkeeping reservation per physical row, independently of lookup replay. */
|
|
66
|
+
reserveRow(table, row, offset) {
|
|
67
|
+
let rows = this.#rows.get(table);
|
|
68
|
+
if (rows?.has(row) === true) return;
|
|
69
|
+
this.reserve(256, offset);
|
|
70
|
+
if (rows === undefined) {
|
|
71
|
+
rows = new Set();
|
|
72
|
+
this.#rows.set(table, rows);
|
|
73
|
+
}
|
|
74
|
+
rows.add(row);
|
|
75
|
+
}
|
|
76
|
+
/** Bound a decoding allocation that stays live until `releaseTransient`; only retained output is reserved. */
|
|
77
|
+
admitTransient(bytes, offset) {
|
|
78
|
+
this.#admit(bytes, offset);
|
|
79
|
+
this.#transient += bytes;
|
|
80
|
+
}
|
|
81
|
+
/** End the current item's decoding; its bookkeeping is unreachable and only reserved output remains. */
|
|
82
|
+
releaseTransient() {
|
|
83
|
+
this.#transient = 0;
|
|
84
|
+
}
|
|
85
|
+
#admit(bytes, offset) {
|
|
86
|
+
if (!Number.isSafeInteger(bytes) || bytes < 0 || bytes > this.#remaining - this.#transient) throw managedFailure("resource-limit", "metadata.representation", `Managed metadata exceeds the ${String(MAX_METADATA_REPRESENTATION_BYTES)} byte representation budget`, offset);
|
|
87
|
+
}
|
|
88
|
+
/** UTF-8 cannot decode to more UTF-16 units than bytes; JSON uses at most six bytes per unit. */
|
|
89
|
+
reserveString(encodedBytes, offset) {
|
|
90
|
+
this.reserve(encodedBytes * 6 + 2, offset);
|
|
91
|
+
}
|
|
92
|
+
/** Snapshot buffers are immutable within a layout; cache exact backing-buffer ranges. */
|
|
93
|
+
digest(bytes, algorithm) {
|
|
94
|
+
let ranges = this.#digests.get(bytes.buffer);
|
|
95
|
+
if (ranges === undefined) {
|
|
96
|
+
ranges = new Map();
|
|
97
|
+
this.#digests.set(bytes.buffer, ranges);
|
|
98
|
+
}
|
|
99
|
+
const key = `${algorithm}:${String(bytes.byteOffset)}:${String(bytes.byteLength)}`;
|
|
100
|
+
const cached = ranges.get(key);
|
|
101
|
+
if (cached !== undefined) return cached;
|
|
102
|
+
this.reserve(256, null);
|
|
103
|
+
const digest = createHash(algorithm).update(bytes).digest("hex");
|
|
104
|
+
ranges.set(key, digest);
|
|
105
|
+
return digest;
|
|
106
|
+
}
|
|
107
|
+
cachedString(index) {
|
|
108
|
+
return this.#strings.get(index);
|
|
109
|
+
}
|
|
110
|
+
cacheString(index, value, encodedBytes) {
|
|
111
|
+
this.#strings.set(index, {
|
|
112
|
+
value,
|
|
113
|
+
encodedBytes
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
budgets = new WeakMap();
|
|
118
|
+
attachManagedDecodeBudget = (layout, budget) => {
|
|
119
|
+
budgets.set(layout, budget);
|
|
120
|
+
};
|
|
121
|
+
managedDecodeBudget = (layout) => {
|
|
122
|
+
let budget = budgets.get(layout);
|
|
123
|
+
if (budget === undefined) {
|
|
124
|
+
budget = new ManagedDecodeBudget();
|
|
125
|
+
budgets.set(layout, budget);
|
|
126
|
+
}
|
|
127
|
+
return budget;
|
|
128
|
+
};
|
|
129
|
+
managedJsonStringBytes = (value) => {
|
|
130
|
+
let bytes = 2;
|
|
131
|
+
for (let index = 0; index < value.length; index++) {
|
|
132
|
+
const unit = value.charCodeAt(index);
|
|
133
|
+
if (unit === 34 || unit === 92) bytes += 2;
|
|
134
|
+
else if (unit < 32) bytes += [
|
|
135
|
+
8,
|
|
136
|
+
9,
|
|
137
|
+
10,
|
|
138
|
+
12,
|
|
139
|
+
13
|
|
140
|
+
].includes(unit) ? 2 : 6;
|
|
141
|
+
else if (unit < 128) bytes += 1;
|
|
142
|
+
else if (unit < 2048) bytes += 2;
|
|
143
|
+
else if (unit >= 55296 && unit <= 56319) {
|
|
144
|
+
const next = value.charCodeAt(index + 1);
|
|
145
|
+
if (next >= 56320 && next <= 57343) {
|
|
146
|
+
bytes += 4;
|
|
147
|
+
index++;
|
|
148
|
+
} else bytes += 6;
|
|
149
|
+
} else if (unit >= 56320 && unit <= 57343) bytes += 6;
|
|
150
|
+
else bytes += 3;
|
|
151
|
+
}
|
|
152
|
+
return bytes;
|
|
153
|
+
};
|
|
154
|
+
jsonBytes = (item) => typeof item === "string" ? managedJsonStringBytes(item) : Buffer.byteLength(JSON.stringify(item) ?? "null");
|
|
155
|
+
admitManagedProjection = (value, budget = new ManagedDecodeBudget()) => {
|
|
156
|
+
const visit = (item) => {
|
|
157
|
+
if (Array.isArray(item)) {
|
|
158
|
+
budget.reserve(item.length + 2, null);
|
|
159
|
+
for (const child of item) visit(child);
|
|
160
|
+
} else if (item !== null && typeof item === "object") {
|
|
161
|
+
budget.reserve(2, null);
|
|
162
|
+
for (const key of Object.keys(item)) {
|
|
163
|
+
budget.reserve(jsonBytes(key) + 2, null);
|
|
164
|
+
visit(Reflect.get(item, key));
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
budget.reserve(jsonBytes(item), null);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
visit(value);
|
|
171
|
+
return value;
|
|
172
|
+
};
|
|
173
|
+
})))();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region dist/dotnet/ManagedPeReader.js
|
|
178
|
+
var managedCli32BitRequirement, requireRange$1, add, architectureFor, resolveRva, mapRva, readDirectory, readCliHeader, readCoffHeader, readOptionalHeader, readSections, readCliDirectory, readManagedPeLayout;
|
|
179
|
+
function init_ManagedPeReader() {
|
|
180
|
+
return (init_ManagedPeReader = __esmMin((() => {
|
|
181
|
+
init_peMachine();
|
|
182
|
+
init_ManagedReaderFailure();
|
|
183
|
+
managedCli32BitRequirement = (flags) => {
|
|
184
|
+
const pair = flags & 131074;
|
|
185
|
+
if (pair === 2) return "required";
|
|
186
|
+
return pair === 131074 ? "preferred" : "none";
|
|
187
|
+
};
|
|
188
|
+
requireRange$1 = (bytes, offset, length, scope) => {
|
|
189
|
+
if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(length) || offset < 0 || length < 0 || offset > bytes.length - length) throw managedFailure("invalid-directory", scope, `${scope} leaves the artifact byte range`, Number.isSafeInteger(offset) && offset >= 0 ? offset : null);
|
|
190
|
+
};
|
|
191
|
+
add = (left, right, scope) => {
|
|
192
|
+
const result = left + right;
|
|
193
|
+
if (!Number.isSafeInteger(result) || result < left) throw managedFailure("invalid-directory", scope, `${scope} offset arithmetic overflowed`, left);
|
|
194
|
+
return result;
|
|
195
|
+
};
|
|
196
|
+
architectureFor = (machine, managed) => {
|
|
197
|
+
const decoded = decodePeMachine(machine);
|
|
198
|
+
if (decoded === undefined || decoded.nativeOsOverride && !managed) throw managedFailure("invalid-directory", "pe.machine", `Unsupported PE machine 0x${machine.toString(16).padStart(4, "0")}`);
|
|
199
|
+
return decoded.architecture;
|
|
200
|
+
};
|
|
201
|
+
resolveRva = (mapping) => {
|
|
202
|
+
const { bytes, sections, rva, size, scope } = mapping;
|
|
203
|
+
if (!Number.isSafeInteger(rva) || !Number.isSafeInteger(size) || rva < 0 || size < 0 || rva > 4294967295 || size > 0 && size > 4294967296 - rva) throw managedFailure("invalid-directory", scope, `${scope} has an invalid RVA range`);
|
|
204
|
+
const selected = sections.find((section) => {
|
|
205
|
+
const within = rva - section.virtualAddress;
|
|
206
|
+
return section.virtualSize > 0 && within >= 0 && within < section.virtualSize && size <= section.virtualSize - within;
|
|
207
|
+
});
|
|
208
|
+
if (selected === undefined) throw managedFailure("invalid-directory", scope, `${scope} RVA is not covered by one PE section`);
|
|
209
|
+
for (const section of sections) {
|
|
210
|
+
if (section === selected || section.virtualSize === 0) continue;
|
|
211
|
+
const end = section.virtualAddress + section.virtualSize;
|
|
212
|
+
const intersects = size === 0 ? rva >= section.virtualAddress && rva < end : rva < end && rva + size > section.virtualAddress;
|
|
213
|
+
if (intersects) throw managedFailure("invalid-directory", scope, `${scope} RVA range has ambiguous overlapping PE section mappings`);
|
|
214
|
+
}
|
|
215
|
+
const within = rva - selected.virtualAddress;
|
|
216
|
+
if (within > selected.rawSize || size > selected.rawSize - within) throw managedFailure("invalid-directory", scope, `${scope} occupies virtual bytes without file-backed data`);
|
|
217
|
+
const offset = add(selected.rawOffset, within, scope);
|
|
218
|
+
requireRange$1(bytes, offset, size, scope);
|
|
219
|
+
let available = Math.min(selected.virtualSize - within, selected.rawSize - within, bytes.length - offset, 4294967296 - rva);
|
|
220
|
+
for (const section of sections) if (section !== selected && section.virtualAddress > rva && section.virtualSize > 0) available = Math.min(available, section.virtualAddress - rva);
|
|
221
|
+
return {
|
|
222
|
+
offset,
|
|
223
|
+
available
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
mapRva = (mapping) => mapping.rva === 0 && mapping.size === 0 ? 0 : resolveRva(mapping).offset;
|
|
227
|
+
readDirectory = (bytes, offset) => {
|
|
228
|
+
requireRange$1(bytes, offset, 8, "pe.data-directory");
|
|
229
|
+
return {
|
|
230
|
+
rva: bytes.readUInt32LE(offset),
|
|
231
|
+
size: bytes.readUInt32LE(offset + 4)
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
readCliHeader = (bytes, sections, directory) => {
|
|
235
|
+
if (directory.size < 72) throw managedFailure("invalid-cli-header", "cli.header", "CLI header is shorter than the required 72 bytes");
|
|
236
|
+
const offset = mapRva({
|
|
237
|
+
bytes,
|
|
238
|
+
sections,
|
|
239
|
+
rva: directory.rva,
|
|
240
|
+
size: 72,
|
|
241
|
+
scope: "cli.header"
|
|
242
|
+
});
|
|
243
|
+
const headerSize = bytes.readUInt32LE(offset);
|
|
244
|
+
if (headerSize < 72 || headerSize > directory.size) throw managedFailure("invalid-cli-header", "cli.header", "CLI header size is outside its PE data directory", offset);
|
|
245
|
+
const metadata = readDirectory(bytes, offset + 8);
|
|
246
|
+
if (metadata.rva === 0 || metadata.size === 0) throw managedFailure("invalid-cli-header", "cli.metadata", "CLI metadata directory is absent", offset + 8);
|
|
247
|
+
const flags = bytes.readUInt32LE(offset + 16);
|
|
248
|
+
const managedNativeHeader = readDirectory(bytes, offset + 64);
|
|
249
|
+
let readyToRunSignature = false;
|
|
250
|
+
if (managedNativeHeader.rva !== 0 && managedNativeHeader.size >= 4) {
|
|
251
|
+
const nativeOffset = mapRva({
|
|
252
|
+
bytes,
|
|
253
|
+
sections,
|
|
254
|
+
rva: managedNativeHeader.rva,
|
|
255
|
+
size: 4,
|
|
256
|
+
scope: "cli.managed-native-header"
|
|
257
|
+
});
|
|
258
|
+
readyToRunSignature = bytes.readUInt32LE(nativeOffset) === 5395538;
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
headerOffset: offset,
|
|
262
|
+
headerSize,
|
|
263
|
+
runtimeMajor: bytes.readUInt16LE(offset + 4),
|
|
264
|
+
runtimeMinor: bytes.readUInt16LE(offset + 6),
|
|
265
|
+
metadata,
|
|
266
|
+
flags,
|
|
267
|
+
entryPoint: bytes.readUInt32LE(offset + 20),
|
|
268
|
+
resources: readDirectory(bytes, offset + 24),
|
|
269
|
+
strongName: readDirectory(bytes, offset + 32),
|
|
270
|
+
managedNativeHeader,
|
|
271
|
+
readyToRunSignature
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
readCoffHeader = (bytes) => {
|
|
275
|
+
const peOffset = bytes.readUInt32LE(60);
|
|
276
|
+
requireRange$1(bytes, peOffset, 24, "pe.coff-header");
|
|
277
|
+
if (bytes.readUInt32LE(peOffset) !== 17744) throw managedFailure("invalid-directory", "pe.signature", "PE signature is invalid", peOffset);
|
|
278
|
+
const coff = peOffset + 4;
|
|
279
|
+
const machine = bytes.readUInt16LE(coff);
|
|
280
|
+
const sectionCount = bytes.readUInt16LE(coff + 2);
|
|
281
|
+
if (sectionCount === 0) throw managedFailure("invalid-directory", "pe.sections", "PE section count must be positive", coff + 2);
|
|
282
|
+
const optionalSize = bytes.readUInt16LE(coff + 16);
|
|
283
|
+
const characteristics = bytes.readUInt16LE(coff + 18);
|
|
284
|
+
return {
|
|
285
|
+
coff,
|
|
286
|
+
machine,
|
|
287
|
+
sectionCount,
|
|
288
|
+
optionalSize,
|
|
289
|
+
characteristics
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
readOptionalHeader = (bytes, coff) => {
|
|
293
|
+
const optionalOffset = coff.coff + 20;
|
|
294
|
+
requireRange$1(bytes, optionalOffset, coff.optionalSize, "pe.optional-header");
|
|
295
|
+
if (coff.optionalSize < 96) throw managedFailure("invalid-directory", "pe.optional-header", "PE optional header is too short", optionalOffset);
|
|
296
|
+
const magic = bytes.readUInt16LE(optionalOffset);
|
|
297
|
+
const optionalHeader = magic === 267 ? "pe32" : magic === 523 ? "pe32-plus" : undefined;
|
|
298
|
+
if (optionalHeader === undefined) throw managedFailure("invalid-directory", "pe.optional-header", "PE optional header magic is unsupported", optionalOffset);
|
|
299
|
+
return {
|
|
300
|
+
optionalOffset,
|
|
301
|
+
optionalHeader,
|
|
302
|
+
directoryCountOffset: optionalOffset + (optionalHeader === "pe32" ? 92 : 108),
|
|
303
|
+
directoryOffset: optionalOffset + (optionalHeader === "pe32" ? 96 : 112)
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
readSections = (bytes, coff, optional) => {
|
|
307
|
+
const sectionOffset = add(optional.optionalOffset, coff.optionalSize, "pe.sections");
|
|
308
|
+
requireRange$1(bytes, sectionOffset, coff.sectionCount * 40, "pe.sections");
|
|
309
|
+
const sections = [];
|
|
310
|
+
for (let index = 0; index < coff.sectionCount; index += 1) {
|
|
311
|
+
const offset = sectionOffset + index * 40;
|
|
312
|
+
const section = {
|
|
313
|
+
virtualSize: bytes.readUInt32LE(offset + 8),
|
|
314
|
+
virtualAddress: bytes.readUInt32LE(offset + 12),
|
|
315
|
+
rawSize: bytes.readUInt32LE(offset + 16),
|
|
316
|
+
rawOffset: bytes.readUInt32LE(offset + 20)
|
|
317
|
+
};
|
|
318
|
+
if (section.rawSize > 0) requireRange$1(bytes, section.rawOffset, section.rawSize, "pe.section-data");
|
|
319
|
+
sections.push(section);
|
|
320
|
+
}
|
|
321
|
+
return sections;
|
|
322
|
+
};
|
|
323
|
+
readCliDirectory = (bytes, coff, optional) => {
|
|
324
|
+
const countOffset = optional.directoryCountOffset - optional.optionalOffset;
|
|
325
|
+
if (countOffset + 4 > coff.optionalSize) return {
|
|
326
|
+
kind: "unreadable",
|
|
327
|
+
issue: {
|
|
328
|
+
code: "invalid-directory",
|
|
329
|
+
scope: "pe.optional-header",
|
|
330
|
+
detail: "PE optional header does not contain its directory count",
|
|
331
|
+
offset: optional.directoryCountOffset
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
const directoryCount = bytes.readUInt32LE(optional.directoryCountOffset);
|
|
335
|
+
if (directoryCount <= 14) return { kind: "absent" };
|
|
336
|
+
const availableDirectoryCount = Math.floor((coff.optionalSize - (optional.directoryOffset - optional.optionalOffset)) / 8);
|
|
337
|
+
if (availableDirectoryCount < 15) return {
|
|
338
|
+
kind: "unreadable",
|
|
339
|
+
issue: {
|
|
340
|
+
code: "invalid-directory",
|
|
341
|
+
scope: "pe.data-directories",
|
|
342
|
+
detail: "PE data-directory count exceeds the optional-header extent",
|
|
343
|
+
offset: optional.directoryCountOffset
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
const directory = readDirectory(bytes, optional.directoryOffset + 14 * 8);
|
|
347
|
+
return directory.rva !== 0 || directory.size !== 0 ? {
|
|
348
|
+
kind: "present",
|
|
349
|
+
directory
|
|
350
|
+
} : { kind: "absent" };
|
|
351
|
+
};
|
|
352
|
+
readManagedPeLayout = (bytes) => {
|
|
353
|
+
requireRange$1(bytes, 0, 64, "pe.dos-header");
|
|
354
|
+
if (bytes[0] !== 77 || bytes[1] !== 90) throw managedFailure("invalid-directory", "pe.dos-header", "Artifact does not start with an MZ header", 0);
|
|
355
|
+
const coff = readCoffHeader(bytes);
|
|
356
|
+
const optional = readOptionalHeader(bytes, coff);
|
|
357
|
+
const sections = readSections(bytes, coff, optional);
|
|
358
|
+
const cliDirectoryRead = readCliDirectory(bytes, coff, optional);
|
|
359
|
+
const cliDirectoryState = cliDirectoryRead.kind;
|
|
360
|
+
let cli = null;
|
|
361
|
+
let cliIssue = cliDirectoryRead.kind === "unreadable" ? cliDirectoryRead.issue : null;
|
|
362
|
+
if (cliDirectoryRead.kind === "present") {
|
|
363
|
+
try {
|
|
364
|
+
cli = readCliHeader(bytes, sections, cliDirectoryRead.directory);
|
|
365
|
+
} catch (cause) {
|
|
366
|
+
if (!(cause instanceof ManagedReaderFailure)) throw cause;
|
|
367
|
+
cliIssue = cause.issue;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return {
|
|
371
|
+
machine: coff.machine,
|
|
372
|
+
architecture: architectureFor(coff.machine, cliDirectoryState !== "absent"),
|
|
373
|
+
optionalHeader: optional.optionalHeader,
|
|
374
|
+
sectionCount: coff.sectionCount,
|
|
375
|
+
characteristics: coff.characteristics,
|
|
376
|
+
sections,
|
|
377
|
+
cli,
|
|
378
|
+
cliDirectoryState,
|
|
379
|
+
cliIssue,
|
|
380
|
+
rvaToOffset: (rva, size, scope) => mapRva({
|
|
381
|
+
bytes,
|
|
382
|
+
sections,
|
|
383
|
+
rva,
|
|
384
|
+
size,
|
|
385
|
+
scope
|
|
386
|
+
}),
|
|
387
|
+
rvaAvailableBytes: (rva, scope) => resolveRva({
|
|
388
|
+
bytes,
|
|
389
|
+
sections,
|
|
390
|
+
rva,
|
|
391
|
+
size: 1,
|
|
392
|
+
scope
|
|
393
|
+
}).available
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
})))();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region dist/dotnet/ManagedMetadataRowSizes.js
|
|
401
|
+
var ROW_SIZE_FACTORIES, computeRowSize;
|
|
402
|
+
function init_ManagedMetadataRowSizes() {
|
|
403
|
+
return (init_ManagedMetadataRowSizes = __esmMin((() => {
|
|
404
|
+
init_ManagedReaderFailure();
|
|
405
|
+
ROW_SIZE_FACTORIES = [
|
|
406
|
+
({ stringSize: s, guidSize: g }) => 2 + s + g * 3,
|
|
407
|
+
({ codedSize: c, stringSize: s }) => c("ResolutionScope") + s * 2,
|
|
408
|
+
({ tableSize: t, codedSize: c, stringSize: s }) => 4 + s * 2 + c("TypeDefOrRef") + Math.max(t(3), t(4)) + Math.max(t(5), t(6)),
|
|
409
|
+
({ tableSize: t }) => t(4),
|
|
410
|
+
({ stringSize: s, blobSize: b }) => 2 + s + b,
|
|
411
|
+
({ tableSize: t }) => t(6),
|
|
412
|
+
({ tableSize: t, stringSize: s, blobSize: b }) => 8 + s + b + t(8),
|
|
413
|
+
({ tableSize: t }) => t(8),
|
|
414
|
+
({ stringSize: s }) => 4 + s,
|
|
415
|
+
({ tableSize: t, codedSize: c }) => t(2) + c("TypeDefOrRef"),
|
|
416
|
+
({ codedSize: c, stringSize: s, blobSize: b }) => c("MemberRefParent") + s + b,
|
|
417
|
+
({ codedSize: c, blobSize: b }) => 2 + c("HasConstant") + b,
|
|
418
|
+
({ codedSize: c, blobSize: b }) => c("HasCustomAttribute") + c("CustomAttributeType") + b,
|
|
419
|
+
({ codedSize: c, blobSize: b }) => c("HasFieldMarshal") + b,
|
|
420
|
+
({ codedSize: c, blobSize: b }) => 2 + c("HasDeclSecurity") + b,
|
|
421
|
+
({ tableSize: t }) => 6 + t(2),
|
|
422
|
+
({ tableSize: t }) => 4 + t(4),
|
|
423
|
+
({ blobSize: b }) => b,
|
|
424
|
+
({ tableSize: t }) => t(2) + t(20),
|
|
425
|
+
({ tableSize: t }) => t(20),
|
|
426
|
+
({ stringSize: s, codedSize: c }) => 2 + s + c("TypeDefOrRef"),
|
|
427
|
+
({ tableSize: t }) => t(2) + t(23),
|
|
428
|
+
({ tableSize: t }) => t(23),
|
|
429
|
+
({ stringSize: s, blobSize: b }) => 2 + s + b,
|
|
430
|
+
({ tableSize: t, codedSize: c }) => 2 + t(6) + c("HasSemantics"),
|
|
431
|
+
({ tableSize: t, codedSize: c }) => t(2) + c("MethodDefOrRef") * 2,
|
|
432
|
+
({ stringSize: s }) => s,
|
|
433
|
+
({ blobSize: b }) => b,
|
|
434
|
+
({ tableSize: t, codedSize: c, stringSize: s }) => 2 + c("MemberForwarded") + s + t(26),
|
|
435
|
+
({ tableSize: t }) => 4 + t(4),
|
|
436
|
+
() => 8,
|
|
437
|
+
() => 4,
|
|
438
|
+
({ blobSize: b, stringSize: s }) => 16 + b + s * 2,
|
|
439
|
+
() => 4,
|
|
440
|
+
() => 12,
|
|
441
|
+
({ blobSize: b, stringSize: s }) => 12 + b * 2 + s * 2,
|
|
442
|
+
({ tableSize: t }) => 4 + t(35),
|
|
443
|
+
({ tableSize: t }) => 12 + t(35),
|
|
444
|
+
({ stringSize: s, blobSize: b }) => 4 + s + b,
|
|
445
|
+
({ stringSize: s, codedSize: c }) => 8 + s * 2 + c("Implementation"),
|
|
446
|
+
({ stringSize: s, codedSize: c }) => 8 + s + c("Implementation"),
|
|
447
|
+
({ tableSize: t }) => t(2) * 2,
|
|
448
|
+
({ stringSize: s, codedSize: c }) => 4 + c("TypeOrMethodDef") + s,
|
|
449
|
+
({ codedSize: c, blobSize: b }) => c("MethodDefOrRef") + b,
|
|
450
|
+
({ tableSize: t, codedSize: c }) => t(42) + c("TypeDefOrRef")
|
|
451
|
+
];
|
|
452
|
+
computeRowSize = (table, context) => {
|
|
453
|
+
const factory = ROW_SIZE_FACTORIES[table];
|
|
454
|
+
if (factory === undefined) throw managedFailure("invalid-tables", "metadata.tables", `Metadata table ${String(table)} is unsupported`);
|
|
455
|
+
return factory(context);
|
|
456
|
+
};
|
|
457
|
+
})))();
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region dist/dotnet/ManagedMetadataLayout.js
|
|
462
|
+
var METADATA_TABLE_NAMES, CODED_INDEXES, SUPPORTED_TABLE_MASK, requireRange, align4, readStreamName, streamByName, requireStream, codedSize, tableSize, readMetadataStreams, readTablesHeader, readRowCounts, buildRowSizeContext, buildMetadataTables, readManagedMetadataLayout, metadataRowOffset;
|
|
463
|
+
function init_ManagedMetadataLayout() {
|
|
464
|
+
return (init_ManagedMetadataLayout = __esmMin((() => {
|
|
465
|
+
init_ManagedDecodeBudget();
|
|
466
|
+
init_ManagedReaderFailure();
|
|
467
|
+
init_ManagedMetadataRowSizes();
|
|
468
|
+
METADATA_TABLE_NAMES = [
|
|
469
|
+
"Module",
|
|
470
|
+
"TypeRef",
|
|
471
|
+
"TypeDef",
|
|
472
|
+
"FieldPtr",
|
|
473
|
+
"Field",
|
|
474
|
+
"MethodPtr",
|
|
475
|
+
"MethodDef",
|
|
476
|
+
"ParamPtr",
|
|
477
|
+
"Param",
|
|
478
|
+
"InterfaceImpl",
|
|
479
|
+
"MemberRef",
|
|
480
|
+
"Constant",
|
|
481
|
+
"CustomAttribute",
|
|
482
|
+
"FieldMarshal",
|
|
483
|
+
"DeclSecurity",
|
|
484
|
+
"ClassLayout",
|
|
485
|
+
"FieldLayout",
|
|
486
|
+
"StandAloneSig",
|
|
487
|
+
"EventMap",
|
|
488
|
+
"EventPtr",
|
|
489
|
+
"Event",
|
|
490
|
+
"PropertyMap",
|
|
491
|
+
"PropertyPtr",
|
|
492
|
+
"Property",
|
|
493
|
+
"MethodSemantics",
|
|
494
|
+
"MethodImpl",
|
|
495
|
+
"ModuleRef",
|
|
496
|
+
"TypeSpec",
|
|
497
|
+
"ImplMap",
|
|
498
|
+
"FieldRVA",
|
|
499
|
+
"ENCLog",
|
|
500
|
+
"ENCMap",
|
|
501
|
+
"Assembly",
|
|
502
|
+
"AssemblyProcessor",
|
|
503
|
+
"AssemblyOS",
|
|
504
|
+
"AssemblyRef",
|
|
505
|
+
"AssemblyRefProcessor",
|
|
506
|
+
"AssemblyRefOS",
|
|
507
|
+
"File",
|
|
508
|
+
"ExportedType",
|
|
509
|
+
"ManifestResource",
|
|
510
|
+
"NestedClass",
|
|
511
|
+
"GenericParam",
|
|
512
|
+
"MethodSpec",
|
|
513
|
+
"GenericParamConstraint"
|
|
514
|
+
];
|
|
515
|
+
CODED_INDEXES = {
|
|
516
|
+
TypeDefOrRef: {
|
|
517
|
+
bits: 2,
|
|
518
|
+
tables: [
|
|
519
|
+
2,
|
|
520
|
+
1,
|
|
521
|
+
27
|
|
522
|
+
]
|
|
523
|
+
},
|
|
524
|
+
HasConstant: {
|
|
525
|
+
bits: 2,
|
|
526
|
+
tables: [
|
|
527
|
+
4,
|
|
528
|
+
8,
|
|
529
|
+
23
|
|
530
|
+
]
|
|
531
|
+
},
|
|
532
|
+
HasCustomAttribute: {
|
|
533
|
+
bits: 5,
|
|
534
|
+
tables: [
|
|
535
|
+
6,
|
|
536
|
+
4,
|
|
537
|
+
1,
|
|
538
|
+
2,
|
|
539
|
+
8,
|
|
540
|
+
9,
|
|
541
|
+
10,
|
|
542
|
+
0,
|
|
543
|
+
14,
|
|
544
|
+
23,
|
|
545
|
+
20,
|
|
546
|
+
17,
|
|
547
|
+
26,
|
|
548
|
+
27,
|
|
549
|
+
32,
|
|
550
|
+
35,
|
|
551
|
+
38,
|
|
552
|
+
39,
|
|
553
|
+
40,
|
|
554
|
+
42,
|
|
555
|
+
44,
|
|
556
|
+
43
|
|
557
|
+
]
|
|
558
|
+
},
|
|
559
|
+
HasFieldMarshal: {
|
|
560
|
+
bits: 1,
|
|
561
|
+
tables: [4, 8]
|
|
562
|
+
},
|
|
563
|
+
HasDeclSecurity: {
|
|
564
|
+
bits: 2,
|
|
565
|
+
tables: [
|
|
566
|
+
2,
|
|
567
|
+
6,
|
|
568
|
+
32
|
|
569
|
+
]
|
|
570
|
+
},
|
|
571
|
+
MemberRefParent: {
|
|
572
|
+
bits: 3,
|
|
573
|
+
tables: [
|
|
574
|
+
2,
|
|
575
|
+
1,
|
|
576
|
+
26,
|
|
577
|
+
6,
|
|
578
|
+
27
|
|
579
|
+
]
|
|
580
|
+
},
|
|
581
|
+
HasSemantics: {
|
|
582
|
+
bits: 1,
|
|
583
|
+
tables: [20, 23]
|
|
584
|
+
},
|
|
585
|
+
MethodDefOrRef: {
|
|
586
|
+
bits: 1,
|
|
587
|
+
tables: [6, 10]
|
|
588
|
+
},
|
|
589
|
+
MemberForwarded: {
|
|
590
|
+
bits: 1,
|
|
591
|
+
tables: [4, 6]
|
|
592
|
+
},
|
|
593
|
+
Implementation: {
|
|
594
|
+
bits: 2,
|
|
595
|
+
tables: [
|
|
596
|
+
38,
|
|
597
|
+
35,
|
|
598
|
+
39
|
|
599
|
+
]
|
|
600
|
+
},
|
|
601
|
+
CustomAttributeType: {
|
|
602
|
+
bits: 3,
|
|
603
|
+
tables: [6, 10]
|
|
604
|
+
},
|
|
605
|
+
ResolutionScope: {
|
|
606
|
+
bits: 2,
|
|
607
|
+
tables: [
|
|
608
|
+
0,
|
|
609
|
+
26,
|
|
610
|
+
35,
|
|
611
|
+
1
|
|
612
|
+
]
|
|
613
|
+
},
|
|
614
|
+
TypeOrMethodDef: {
|
|
615
|
+
bits: 1,
|
|
616
|
+
tables: [2, 6]
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
SUPPORTED_TABLE_MASK = (1n << BigInt(METADATA_TABLE_NAMES.length)) - 1n;
|
|
620
|
+
requireRange = (bytes, offset, length, scope) => {
|
|
621
|
+
if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(length) || offset < 0 || length < 0 || offset > bytes.length - length) throw managedFailure("invalid-metadata-root", scope, `${scope} leaves the metadata byte range`, Number.isSafeInteger(offset) && offset >= 0 ? offset : null);
|
|
622
|
+
};
|
|
623
|
+
align4 = (value) => Math.ceil(value / 4) * 4;
|
|
624
|
+
readStreamName = (bytes, offset) => {
|
|
625
|
+
const endLimit = Math.min(bytes.length, offset + 32);
|
|
626
|
+
let end = offset;
|
|
627
|
+
while (end < endLimit && bytes[end] !== 0) end += 1;
|
|
628
|
+
if (end === endLimit) throw managedFailure("invalid-stream", "metadata.stream-name", "Metadata stream name is missing a bounded terminator", offset);
|
|
629
|
+
const nameBytes = bytes.subarray(offset, end);
|
|
630
|
+
if (nameBytes.some((byte) => byte < 32 || byte > 126)) throw managedFailure("invalid-stream", "metadata.stream-name", "Metadata stream name is not printable ASCII", offset);
|
|
631
|
+
return {
|
|
632
|
+
name: nameBytes.toString("ascii"),
|
|
633
|
+
next: align4(end + 1)
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
streamByName = (streams, names) => {
|
|
637
|
+
for (const name of names) {
|
|
638
|
+
const stream = streams.get(name);
|
|
639
|
+
if (stream !== undefined) return stream;
|
|
640
|
+
}
|
|
641
|
+
return undefined;
|
|
642
|
+
};
|
|
643
|
+
requireStream = (streams, name) => {
|
|
644
|
+
const stream = streams.get(name);
|
|
645
|
+
if (stream === undefined) throw managedFailure("missing-stream", `metadata.${name}`, `Required metadata stream ${name} is absent`);
|
|
646
|
+
return stream;
|
|
647
|
+
};
|
|
648
|
+
codedSize = (name, rowCounts) => {
|
|
649
|
+
const descriptor = CODED_INDEXES[name];
|
|
650
|
+
let maximum = 0;
|
|
651
|
+
for (const table of descriptor.tables) maximum = Math.max(maximum, rowCounts[table] ?? 0);
|
|
652
|
+
return maximum < 2 ** (16 - descriptor.bits) ? 2 : 4;
|
|
653
|
+
};
|
|
654
|
+
tableSize = (index, rows) => (rows[index] ?? 0) < 65536 ? 2 : 4;
|
|
655
|
+
readMetadataStreams = (bytes, rootOffset, budget) => {
|
|
656
|
+
if (bytes.readUInt32LE(0) !== 1112167234) throw managedFailure("invalid-metadata-root", "metadata.signature", "CLI metadata signature is not BSJB", rootOffset);
|
|
657
|
+
const versionLength = bytes.readUInt32LE(12);
|
|
658
|
+
requireRange(bytes, 16, versionLength, "metadata.version");
|
|
659
|
+
const versionBytes = bytes.subarray(16, 16 + versionLength);
|
|
660
|
+
const zero = versionBytes.indexOf(0);
|
|
661
|
+
const decodedVersionLength = zero < 0 ? versionBytes.length : zero;
|
|
662
|
+
budget.reserveString(decodedVersionLength, rootOffset + 16);
|
|
663
|
+
const version = versionBytes.subarray(0, decodedVersionLength).toString("utf8");
|
|
664
|
+
let cursor = align4(16 + versionLength);
|
|
665
|
+
requireRange(bytes, cursor, 4, "metadata.stream-count");
|
|
666
|
+
const streamCount = bytes.readUInt16LE(cursor + 2);
|
|
667
|
+
if (streamCount === 0 || streamCount > 64) throw managedFailure("invalid-stream", "metadata.stream-count", "Metadata stream count is outside the admitted range", rootOffset + cursor + 2);
|
|
668
|
+
cursor += 4;
|
|
669
|
+
const streams = new Map();
|
|
670
|
+
for (let index = 0; index < streamCount; index += 1) {
|
|
671
|
+
requireRange(bytes, cursor, 8, "metadata.stream-header");
|
|
672
|
+
const relativeOffset = bytes.readUInt32LE(cursor);
|
|
673
|
+
const streamSize = bytes.readUInt32LE(cursor + 4);
|
|
674
|
+
const named = readStreamName(bytes, cursor + 8);
|
|
675
|
+
if (streams.has(named.name)) throw managedFailure("invalid-stream", "metadata.stream-header", `Duplicate metadata stream ${named.name}`, rootOffset + cursor);
|
|
676
|
+
requireRange(bytes, relativeOffset, streamSize, `metadata.${named.name}`);
|
|
677
|
+
streams.set(named.name, {
|
|
678
|
+
name: named.name,
|
|
679
|
+
offset: rootOffset + relativeOffset,
|
|
680
|
+
size: streamSize
|
|
681
|
+
});
|
|
682
|
+
cursor = named.next;
|
|
683
|
+
}
|
|
684
|
+
return {
|
|
685
|
+
streams,
|
|
686
|
+
version
|
|
687
|
+
};
|
|
688
|
+
};
|
|
689
|
+
readTablesHeader = (bytes, streams) => {
|
|
690
|
+
const tablesStream = streamByName(streams, ["#~", "#-"]);
|
|
691
|
+
if (tablesStream === undefined) throw managedFailure("missing-stream", "metadata.tables", "Required metadata table stream #~ or #- is absent");
|
|
692
|
+
const tableBytes = bytes.subarray(tablesStream.offset, tablesStream.offset + tablesStream.size);
|
|
693
|
+
requireRange(tableBytes, 0, 24, "metadata.tables-header");
|
|
694
|
+
const heapSizes = tableBytes[6] ?? 0;
|
|
695
|
+
const heaps = {
|
|
696
|
+
string: (heapSizes & 1) === 0 ? 2 : 4,
|
|
697
|
+
guid: (heapSizes & 2) === 0 ? 2 : 4,
|
|
698
|
+
blob: (heapSizes & 4) === 0 ? 2 : 4
|
|
699
|
+
};
|
|
700
|
+
const valid = tableBytes.readBigUInt64LE(8);
|
|
701
|
+
if ((valid & ~SUPPORTED_TABLE_MASK) !== 0n) throw managedFailure("invalid-tables", "metadata.valid-mask", "Metadata valid mask names unsupported tables outside the admitted ECMA-335 range", tablesStream.offset + 8);
|
|
702
|
+
return {
|
|
703
|
+
tableBytes,
|
|
704
|
+
tablesOffset: tablesStream.offset,
|
|
705
|
+
heaps,
|
|
706
|
+
valid
|
|
707
|
+
};
|
|
708
|
+
};
|
|
709
|
+
readRowCounts = (tableBytes, valid) => {
|
|
710
|
+
const rowCounts = Array(METADATA_TABLE_NAMES.length).fill(0);
|
|
711
|
+
let tableCursor = 24;
|
|
712
|
+
for (let index = 0; index < METADATA_TABLE_NAMES.length; index += 1) {
|
|
713
|
+
if ((valid & 1n << BigInt(index)) === 0n) continue;
|
|
714
|
+
requireRange(tableBytes, tableCursor, 4, "metadata.table-row-count");
|
|
715
|
+
const count = tableBytes.readUInt32LE(tableCursor);
|
|
716
|
+
rowCounts[index] = count;
|
|
717
|
+
tableCursor += 4;
|
|
718
|
+
}
|
|
719
|
+
return rowCounts;
|
|
720
|
+
};
|
|
721
|
+
buildRowSizeContext = (rowCounts, heaps) => ({
|
|
722
|
+
tableSize: (index) => tableSize(index, rowCounts),
|
|
723
|
+
codedSize: (name) => codedSize(name, rowCounts),
|
|
724
|
+
stringSize: heaps.string,
|
|
725
|
+
guidSize: heaps.guid,
|
|
726
|
+
blobSize: heaps.blob
|
|
727
|
+
});
|
|
728
|
+
buildMetadataTables = ({ tableBytes, rowCounts, heaps, valid, tablesOffset }) => {
|
|
729
|
+
const tables = new Map();
|
|
730
|
+
const context = buildRowSizeContext(rowCounts, heaps);
|
|
731
|
+
let tableCursor = 24;
|
|
732
|
+
for (let index = 0; index < METADATA_TABLE_NAMES.length; index += 1) {
|
|
733
|
+
if ((valid & 1n << BigInt(index)) === 0n) continue;
|
|
734
|
+
tableCursor += 4;
|
|
735
|
+
}
|
|
736
|
+
if (((tableBytes[6] ?? 0) & 64) !== 0) {
|
|
737
|
+
if (tableCursor > tableBytes.length - 4) throw managedFailure("invalid-metadata-root", "metadata.tables-extra-data", "Metadata tables extra-data word is truncated", tablesOffset + tableCursor);
|
|
738
|
+
tableCursor += 4;
|
|
739
|
+
}
|
|
740
|
+
for (let index = 0; index < METADATA_TABLE_NAMES.length; index += 1) {
|
|
741
|
+
const count = rowCounts[index] ?? 0;
|
|
742
|
+
if ((valid & 1n << BigInt(index)) === 0n) continue;
|
|
743
|
+
const sizeOfRow = computeRowSize(index, context);
|
|
744
|
+
const byteLength = count * sizeOfRow;
|
|
745
|
+
if (!Number.isSafeInteger(byteLength)) throw managedFailure("invalid-tables", "metadata.tables", "Metadata table byte size overflowed", tablesOffset + tableCursor);
|
|
746
|
+
requireRange(tableBytes, tableCursor, byteLength, "metadata.table-data");
|
|
747
|
+
tables.set(index, {
|
|
748
|
+
index,
|
|
749
|
+
name: METADATA_TABLE_NAMES[index] ?? `Table${String(index)}`,
|
|
750
|
+
rowCount: count,
|
|
751
|
+
rowSize: sizeOfRow,
|
|
752
|
+
offset: tablesOffset + tableCursor
|
|
753
|
+
});
|
|
754
|
+
tableCursor += byteLength;
|
|
755
|
+
}
|
|
756
|
+
return tables;
|
|
757
|
+
};
|
|
758
|
+
readManagedMetadataLayout = (artifact, rootOffset, size) => {
|
|
759
|
+
if (size < 20 || rootOffset < 0 || rootOffset > artifact.length - size) throw managedFailure("invalid-metadata-root", "metadata.root", "CLI metadata directory leaves the artifact byte range", rootOffset);
|
|
760
|
+
const bytes = artifact.subarray(rootOffset, rootOffset + size);
|
|
761
|
+
const budget = new ManagedDecodeBudget();
|
|
762
|
+
const { streams, version } = readMetadataStreams(bytes, rootOffset, budget);
|
|
763
|
+
const { tableBytes, tablesOffset, heaps, valid } = readTablesHeader(artifact, streams);
|
|
764
|
+
const rowCounts = readRowCounts(tableBytes, valid);
|
|
765
|
+
const tables = buildMetadataTables({
|
|
766
|
+
tableBytes,
|
|
767
|
+
rowCounts,
|
|
768
|
+
heaps,
|
|
769
|
+
valid,
|
|
770
|
+
tablesOffset
|
|
771
|
+
});
|
|
772
|
+
const layout = {
|
|
773
|
+
rootOffset,
|
|
774
|
+
size,
|
|
775
|
+
version,
|
|
776
|
+
streamNames: [...streams.keys()].sort(),
|
|
777
|
+
strings: requireStream(streams, "#Strings"),
|
|
778
|
+
guid: requireStream(streams, "#GUID"),
|
|
779
|
+
blob: requireStream(streams, "#Blob"),
|
|
780
|
+
userStrings: streams.get("#US") ?? null,
|
|
781
|
+
tables,
|
|
782
|
+
rowCounts,
|
|
783
|
+
stringIndexSize: heaps.string,
|
|
784
|
+
guidIndexSize: heaps.guid,
|
|
785
|
+
blobIndexSize: heaps.blob,
|
|
786
|
+
table: (index) => tables.get(index),
|
|
787
|
+
tableIndexSize: (index) => tableSize(index, rowCounts),
|
|
788
|
+
codedIndexSize: (name) => codedSize(name, rowCounts)
|
|
789
|
+
};
|
|
790
|
+
attachManagedDecodeBudget(layout, budget);
|
|
791
|
+
return layout;
|
|
792
|
+
};
|
|
793
|
+
metadataRowOffset = (layout, table, row) => {
|
|
794
|
+
const descriptor = layout.table(table);
|
|
795
|
+
if (descriptor === undefined || row < 1 || row > descriptor.rowCount) throw managedFailure("invalid-row", `metadata.${METADATA_TABLE_NAMES[table] ?? String(table)}`, `Metadata row ${String(row)} is outside its table`);
|
|
796
|
+
return descriptor.offset + (row - 1) * descriptor.rowSize;
|
|
797
|
+
};
|
|
798
|
+
})))();
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
//#endregion
|
|
802
|
+
//#region dist/dotnet/ManagedMemberPointers.js
|
|
803
|
+
var lookups$1, memberListTable, memberListIndexSize, validatedMemberListStart, memberListRowLookup;
|
|
804
|
+
function init_ManagedMemberPointers() {
|
|
805
|
+
return (init_ManagedMemberPointers = __esmMin((() => {
|
|
806
|
+
init_ManagedDecodeBudget();
|
|
807
|
+
init_ManagedReaderFailure();
|
|
808
|
+
lookups$1 = new WeakMap();
|
|
809
|
+
memberListTable = (layout, table) => {
|
|
810
|
+
const pointers = layout.table(table - 1);
|
|
811
|
+
return pointers !== undefined && pointers.rowCount > 0 ? pointers : layout.table(table);
|
|
812
|
+
};
|
|
813
|
+
memberListIndexSize = (layout, table) => layout.tableIndexSize(table - 1) === 4 || layout.tableIndexSize(table) === 4 ? 4 : 2;
|
|
814
|
+
validatedMemberListStart = (start, table) => {
|
|
815
|
+
const total = table?.rowCount ?? 0;
|
|
816
|
+
return Number.isSafeInteger(start) && start >= 1 && start <= total + 1 ? start : null;
|
|
817
|
+
};
|
|
818
|
+
memberListRowLookup = (bytes, layout, table) => {
|
|
819
|
+
const pointers = layout.table(table - 1);
|
|
820
|
+
if (pointers === undefined || pointers.rowCount === 0) return (row) => row;
|
|
821
|
+
let byTable = lookups$1.get(layout);
|
|
822
|
+
const cached = byTable?.get(table);
|
|
823
|
+
if (cached instanceof ManagedReaderFailure) throw cached;
|
|
824
|
+
if (cached !== undefined) return cached;
|
|
825
|
+
const definitionCount = layout.table(table)?.rowCount ?? 0;
|
|
826
|
+
managedDecodeBudget(layout).reserve((definitionCount + 1) * Uint32Array.BYTES_PER_ELEMENT + 256, pointers.offset);
|
|
827
|
+
if (byTable === undefined) {
|
|
828
|
+
byTable = new Map();
|
|
829
|
+
lookups$1.set(layout, byTable);
|
|
830
|
+
}
|
|
831
|
+
const positions = new Uint32Array(definitionCount + 1);
|
|
832
|
+
try {
|
|
833
|
+
const width = layout.tableIndexSize(table);
|
|
834
|
+
for (let row = 1; row <= pointers.rowCount; row += 1) {
|
|
835
|
+
const offset = pointers.offset + (row - 1) * pointers.rowSize;
|
|
836
|
+
const definition = width === 2 ? bytes.readUInt16LE(offset) : bytes.readUInt32LE(offset);
|
|
837
|
+
if (definition === 0 || definition > definitionCount) throw managedFailure("invalid-row", `metadata.${pointers.name}`, `Pointer row ${String(row)} names an out-of-range definition row ${String(definition)}`, offset);
|
|
838
|
+
if (positions[definition] !== 0) throw managedFailure("invalid-row", `metadata.${pointers.name}`, `Definition row ${String(definition)} has more than one pointer row; its declaring type is ambiguous`, offset);
|
|
839
|
+
positions[definition] = row;
|
|
840
|
+
}
|
|
841
|
+
const lookup = (definition) => {
|
|
842
|
+
const position = positions[definition] ?? 0;
|
|
843
|
+
if (position === 0) throw managedFailure("invalid-row", `metadata.${pointers.name}`, `Definition row ${String(definition)} has no pointer row identifying its declaring type`, pointers.offset);
|
|
844
|
+
return position;
|
|
845
|
+
};
|
|
846
|
+
byTable.set(table, lookup);
|
|
847
|
+
return lookup;
|
|
848
|
+
} catch (cause) {
|
|
849
|
+
if (cause instanceof ManagedReaderFailure) byTable.set(table, cause);
|
|
850
|
+
throw cause;
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
})))();
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region dist/dotnet/ManagedMemberOwnership.js
|
|
858
|
+
var lookups, memberDeclaringTypeRowLookup;
|
|
859
|
+
function init_ManagedMemberOwnership() {
|
|
860
|
+
return (init_ManagedMemberOwnership = __esmMin((() => {
|
|
861
|
+
init_ManagedDecodeBudget();
|
|
862
|
+
init_ManagedMemberPointers();
|
|
863
|
+
init_ManagedReaderFailure();
|
|
864
|
+
lookups = new WeakMap();
|
|
865
|
+
memberDeclaringTypeRowLookup = (bytes, layout, table, facts) => {
|
|
866
|
+
let byTable = lookups.get(facts);
|
|
867
|
+
const cached = byTable?.get(table);
|
|
868
|
+
if (cached instanceof ManagedReaderFailure) throw cached;
|
|
869
|
+
if (cached !== undefined) return cached;
|
|
870
|
+
if (byTable === undefined) {
|
|
871
|
+
byTable = new Map();
|
|
872
|
+
lookups.set(facts, byTable);
|
|
873
|
+
}
|
|
874
|
+
try {
|
|
875
|
+
const positionOf = memberListRowLookup(bytes, layout, table);
|
|
876
|
+
const positions = memberListTable(layout, table)?.rowCount ?? 0;
|
|
877
|
+
const types = layout.table(2)?.rowCount ?? 0;
|
|
878
|
+
managedDecodeBudget(layout).reserve((2 * positions + 3) * Uint32Array.BYTES_PER_ELEMENT + 256, layout.table(2)?.offset ?? null);
|
|
879
|
+
const owners = new Uint32Array(positions + 1);
|
|
880
|
+
const next = Uint32Array.from({ length: positions + 2 }, (_, p) => p);
|
|
881
|
+
const unowned = (position) => {
|
|
882
|
+
let root = position;
|
|
883
|
+
while (next[root] !== root) root = next[root] ?? root;
|
|
884
|
+
for (let p = position; p !== root;) {
|
|
885
|
+
const following = next[p] ?? root;
|
|
886
|
+
next[p] = root;
|
|
887
|
+
p = following;
|
|
888
|
+
}
|
|
889
|
+
return root;
|
|
890
|
+
};
|
|
891
|
+
for (let row = 1; row <= types; row += 1) {
|
|
892
|
+
const memberStart = table === 4 ? facts.entries[row - 1]?.field : facts.entries[row - 1]?.method;
|
|
893
|
+
const start = memberStart?.start.value ?? null;
|
|
894
|
+
const end = memberStart?.end ?? null;
|
|
895
|
+
if (start !== null && end !== null) {
|
|
896
|
+
const limit = Math.min(end, positions + 1);
|
|
897
|
+
for (let p = unowned(Math.min(start, positions + 1)); p < limit; p = unowned(p + 1)) {
|
|
898
|
+
owners[p] = row;
|
|
899
|
+
next[p] = p + 1;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
const definitions = layout.table(table)?.rowCount ?? 0;
|
|
904
|
+
const lookup = (definition) => definition < 1 || definition > definitions ? 0 : owners[positionOf(definition)] ?? 0;
|
|
905
|
+
byTable.set(table, lookup);
|
|
906
|
+
return lookup;
|
|
907
|
+
} catch (cause) {
|
|
908
|
+
if (cause instanceof ManagedReaderFailure) byTable.set(table, cause);
|
|
909
|
+
throw cause;
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
})))();
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
//#endregion
|
|
916
|
+
//#region dist/dotnet/ManagedMetadataHeaps.js
|
|
917
|
+
var MetadataRowCursor, PREFIXED_ITEMS, compressedLength, readMetadataString, readMetadataBlob, readMetadataUserString, readMetadataGuid, metadataToken, sha256Bytes, metadataRowCursor, metadataCodedToken, metadataCodedTokenInvalidReason;
|
|
918
|
+
function init_ManagedMetadataHeaps() {
|
|
919
|
+
return (init_ManagedMetadataHeaps = __esmMin((() => {
|
|
920
|
+
init_ManagedDecodeBudget();
|
|
921
|
+
init_ManagedMetadataLayout();
|
|
922
|
+
init_ManagedReaderFailure();
|
|
923
|
+
MetadataRowCursor = class {
|
|
924
|
+
bytes;
|
|
925
|
+
start;
|
|
926
|
+
end;
|
|
927
|
+
scope;
|
|
928
|
+
#offset;
|
|
929
|
+
constructor(bytes, start, end, scope) {
|
|
930
|
+
this.bytes = bytes;
|
|
931
|
+
this.start = start;
|
|
932
|
+
this.end = end;
|
|
933
|
+
this.scope = scope;
|
|
934
|
+
this.#offset = start;
|
|
935
|
+
}
|
|
936
|
+
get offset() {
|
|
937
|
+
return this.#offset;
|
|
938
|
+
}
|
|
939
|
+
readUInt16() {
|
|
940
|
+
this.require(2);
|
|
941
|
+
const value = this.bytes.readUInt16LE(this.#offset);
|
|
942
|
+
this.#offset += 2;
|
|
943
|
+
return value;
|
|
944
|
+
}
|
|
945
|
+
readUInt32() {
|
|
946
|
+
this.require(4);
|
|
947
|
+
const value = this.bytes.readUInt32LE(this.#offset);
|
|
948
|
+
this.#offset += 4;
|
|
949
|
+
return value;
|
|
950
|
+
}
|
|
951
|
+
readIndex(size) {
|
|
952
|
+
return size === 2 ? this.readUInt16() : this.readUInt32();
|
|
953
|
+
}
|
|
954
|
+
require(length) {
|
|
955
|
+
if (this.#offset < this.start || this.#offset > this.end - length) throw managedFailure("invalid-row", this.scope, `${this.scope} row ended before all declared columns`, this.#offset);
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
PREFIXED_ITEMS = {
|
|
959
|
+
blob: {
|
|
960
|
+
code: "invalid-blob",
|
|
961
|
+
label: "Metadata blob"
|
|
962
|
+
},
|
|
963
|
+
userString: {
|
|
964
|
+
code: "invalid-string",
|
|
965
|
+
label: "User string"
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
compressedLength = (bytes, offset, scope, item) => {
|
|
969
|
+
const { code, label } = PREFIXED_ITEMS[item];
|
|
970
|
+
const requirePrefix = (size) => {
|
|
971
|
+
if (offset < 0 || offset > bytes.length - size) throw managedFailure(code, scope, `${label} length prefix leaves the artifact byte range`, offset >= 0 ? offset : null);
|
|
972
|
+
};
|
|
973
|
+
requirePrefix(1);
|
|
974
|
+
const first = bytes[offset] ?? 0;
|
|
975
|
+
if ((first & 128) === 0) return {
|
|
976
|
+
length: first,
|
|
977
|
+
prefix: 1,
|
|
978
|
+
minimal: true
|
|
979
|
+
};
|
|
980
|
+
if ((first & 192) === 128) {
|
|
981
|
+
requirePrefix(2);
|
|
982
|
+
const length = (first & 63) << 8 | (bytes[offset + 1] ?? 0);
|
|
983
|
+
return {
|
|
984
|
+
length,
|
|
985
|
+
prefix: 2,
|
|
986
|
+
minimal: length >= 128
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
if ((first & 224) === 192) {
|
|
990
|
+
requirePrefix(4);
|
|
991
|
+
const length = (first & 31) * 16777216 + (bytes[offset + 1] ?? 0) * 65536 + (bytes[offset + 2] ?? 0) * 256 + (bytes[offset + 3] ?? 0);
|
|
992
|
+
return {
|
|
993
|
+
length,
|
|
994
|
+
prefix: 4,
|
|
995
|
+
minimal: length >= 16384
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
throw managedFailure(code, scope, `${label} uses a reserved compressed-length prefix`, offset);
|
|
999
|
+
};
|
|
1000
|
+
readMetadataString = (bytes, layout, index, heapExtent) => {
|
|
1001
|
+
if (index === 0) return "";
|
|
1002
|
+
if (index < 0 || index >= layout.strings.size) throw managedFailure("invalid-heap-index", "metadata.#Strings", "String heap index is outside #Strings", layout.strings.offset + Math.max(index, 0));
|
|
1003
|
+
const start = layout.strings.offset + index;
|
|
1004
|
+
const cached = managedDecodeBudget(layout).cachedString(index);
|
|
1005
|
+
if (cached !== undefined && cached.encodedBytes <= heapExtent) {
|
|
1006
|
+
managedDecodeBudget(layout).reserveString(cached.encodedBytes, start);
|
|
1007
|
+
return cached.value;
|
|
1008
|
+
}
|
|
1009
|
+
const maximum = Math.min(layout.strings.offset + layout.strings.size, start + heapExtent + 1);
|
|
1010
|
+
let end = start;
|
|
1011
|
+
while (end < maximum && bytes[end] !== 0) end += 1;
|
|
1012
|
+
if (end === maximum) throw managedFailure("invalid-string", "metadata.#Strings", "String heap item has no terminator within #Strings", start);
|
|
1013
|
+
managedDecodeBudget(layout).reserveString(end - start, start);
|
|
1014
|
+
try {
|
|
1015
|
+
const value = new TextDecoder("utf-8", {
|
|
1016
|
+
fatal: true,
|
|
1017
|
+
ignoreBOM: true
|
|
1018
|
+
}).decode(bytes.subarray(start, end));
|
|
1019
|
+
managedDecodeBudget(layout).cacheString(index, value, end - start);
|
|
1020
|
+
return value;
|
|
1021
|
+
} catch (cause) {
|
|
1022
|
+
void cause;
|
|
1023
|
+
throw managedFailure("invalid-string", "metadata.#Strings", "String heap item is not valid UTF-8", start);
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
readMetadataBlob = (bytes, layout, index, heapExtent) => {
|
|
1027
|
+
if (index === 0) return Buffer.alloc(0);
|
|
1028
|
+
if (index < 0 || index >= layout.blob.size) throw managedFailure("invalid-heap-index", "metadata.#Blob", "Blob heap index is outside #Blob", layout.blob.offset + Math.max(index, 0));
|
|
1029
|
+
const start = layout.blob.offset + index;
|
|
1030
|
+
const decoded = compressedLength(bytes, start, "metadata.#Blob", "blob");
|
|
1031
|
+
if (decoded.length > heapExtent) throw managedFailure("invalid-blob", "metadata.#Blob", "Blob length exceeds the admitted heap extent", start);
|
|
1032
|
+
const content = start + decoded.prefix;
|
|
1033
|
+
if (content > layout.blob.offset + layout.blob.size - decoded.length) throw managedFailure("invalid-blob", "metadata.#Blob", "Blob heap item leaves #Blob", start);
|
|
1034
|
+
return bytes.subarray(content, content + decoded.length);
|
|
1035
|
+
};
|
|
1036
|
+
readMetadataUserString = (bytes, layout, token) => {
|
|
1037
|
+
const heap = layout.userStrings;
|
|
1038
|
+
const scope = `metadata.#US:${token}`;
|
|
1039
|
+
if (heap === null) throw managedFailure("missing-stream", scope, "ldstr references #US, but the metadata has no #US stream");
|
|
1040
|
+
const index = Number.parseInt(token.slice(4), 16);
|
|
1041
|
+
if (index >= heap.size) throw managedFailure("invalid-heap-index", scope, "ldstr operand does not name an item inside #US", heap.offset + index);
|
|
1042
|
+
const start = heap.offset + index;
|
|
1043
|
+
const decoded = compressedLength(bytes, start, scope, "userString");
|
|
1044
|
+
const content = start + decoded.prefix;
|
|
1045
|
+
if (content > heap.offset + heap.size - decoded.length) throw managedFailure("invalid-string", scope, "User string leaves #US", start);
|
|
1046
|
+
const budget = managedDecodeBudget(layout);
|
|
1047
|
+
const conformance = () => {
|
|
1048
|
+
if (decoded.minimal) return [];
|
|
1049
|
+
budget.reserve(512, start);
|
|
1050
|
+
return [{
|
|
1051
|
+
code: "invalid-string",
|
|
1052
|
+
scope,
|
|
1053
|
+
offset: start,
|
|
1054
|
+
detail: `User string length ${String(decoded.length)} uses a ${String(decoded.prefix)}-byte prefix wider than ECMA-335 II.23.2 assigns; readable UTF-16 is preserved and runtime acceptance is not assessed`
|
|
1055
|
+
}];
|
|
1056
|
+
};
|
|
1057
|
+
if (index === 0) {
|
|
1058
|
+
if (decoded.length === 0) return {
|
|
1059
|
+
offset: start,
|
|
1060
|
+
value: "",
|
|
1061
|
+
issues: conformance()
|
|
1062
|
+
};
|
|
1063
|
+
throw managedFailure("invalid-string", scope, `#US offset 0 is the reserved empty entry, but it encodes ${String(decoded.length)} byte(s)`, start);
|
|
1064
|
+
}
|
|
1065
|
+
if (decoded.length % 2 !== 1) throw managedFailure("invalid-string", scope, "User string length is not UTF-16 code units plus one terminal flag byte", start);
|
|
1066
|
+
const units = (decoded.length - 1) / 2;
|
|
1067
|
+
budget.reserveString(units, start);
|
|
1068
|
+
let expectedFlag = 0;
|
|
1069
|
+
for (let unitIndex = 0; unitIndex < units; unitIndex++) {
|
|
1070
|
+
const unit = bytes.readUInt16LE(content + unitIndex * 2);
|
|
1071
|
+
if (unit > 255 || unit >= 1 && unit <= 8 || unit >= 14 && unit <= 31 || unit === 39 || unit === 45 || unit === 127) {
|
|
1072
|
+
expectedFlag = 1;
|
|
1073
|
+
break;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
const flagOffset = content + units * 2;
|
|
1077
|
+
const actualFlag = bytes[flagOffset];
|
|
1078
|
+
const issues = conformance();
|
|
1079
|
+
if (actualFlag !== expectedFlag) {
|
|
1080
|
+
budget.reserve(512, flagOffset);
|
|
1081
|
+
issues.push({
|
|
1082
|
+
code: "invalid-string",
|
|
1083
|
+
scope,
|
|
1084
|
+
offset: flagOffset,
|
|
1085
|
+
detail: `User string terminal flag ${String(actualFlag)} differs from ECMA-335 II.24.2.4 value ${String(expectedFlag)}; readable UTF-16 is preserved and runtime acceptance is not assessed`
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
return {
|
|
1089
|
+
offset: start,
|
|
1090
|
+
value: bytes.subarray(content, flagOffset).toString("utf16le"),
|
|
1091
|
+
issues
|
|
1092
|
+
};
|
|
1093
|
+
};
|
|
1094
|
+
readMetadataGuid = (bytes, layout, index) => {
|
|
1095
|
+
if (index === 0) return null;
|
|
1096
|
+
const relative = (index - 1) * 16;
|
|
1097
|
+
if (relative < 0 || relative > layout.guid.size - 16) throw managedFailure("invalid-guid", "metadata.#GUID", "GUID heap index is outside #GUID", layout.guid.offset + Math.max(relative, 0));
|
|
1098
|
+
const offset = layout.guid.offset + relative;
|
|
1099
|
+
const part1 = bytes.readUInt32LE(offset).toString(16).padStart(8, "0");
|
|
1100
|
+
const part2 = bytes.readUInt16LE(offset + 4).toString(16).padStart(4, "0");
|
|
1101
|
+
const part3 = bytes.readUInt16LE(offset + 6).toString(16).padStart(4, "0");
|
|
1102
|
+
const part4 = bytes.subarray(offset + 8, offset + 10).toString("hex");
|
|
1103
|
+
const part5 = bytes.subarray(offset + 10, offset + 16).toString("hex");
|
|
1104
|
+
return `${part1}-${part2}-${part3}-${part4}-${part5}`;
|
|
1105
|
+
};
|
|
1106
|
+
metadataToken = (table, row) => `0x${(table * 16777216 + row).toString(16).padStart(8, "0")}`;
|
|
1107
|
+
sha256Bytes = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
1108
|
+
metadataRowCursor = (bytes, layout, table, row) => {
|
|
1109
|
+
const descriptor = layout.table(table);
|
|
1110
|
+
const start = metadataRowOffset(layout, table, row);
|
|
1111
|
+
if (descriptor === undefined) throw managedFailure("invalid-row", `metadata.${String(table)}`, "Metadata table is absent", start);
|
|
1112
|
+
managedDecodeBudget(layout).reserveRow(table, row, start);
|
|
1113
|
+
return new MetadataRowCursor(bytes, start, start + descriptor.rowSize, `metadata.${descriptor.name}`);
|
|
1114
|
+
};
|
|
1115
|
+
metadataCodedToken = (raw, bits, tables, rowCounts) => {
|
|
1116
|
+
if (raw === 0) return null;
|
|
1117
|
+
const tag = raw & 2 ** bits - 1;
|
|
1118
|
+
const row = Math.floor(raw / 2 ** bits);
|
|
1119
|
+
const table = tables[tag];
|
|
1120
|
+
return table === undefined || row === 0 || row > (rowCounts[table] ?? 0) ? null : metadataToken(table, row);
|
|
1121
|
+
};
|
|
1122
|
+
metadataCodedTokenInvalidReason = (raw, bits, tables, rowCounts) => {
|
|
1123
|
+
if (raw === 0) return null;
|
|
1124
|
+
const tag = raw & 2 ** bits - 1;
|
|
1125
|
+
const row = Math.floor(raw / 2 ** bits);
|
|
1126
|
+
const table = tables[tag];
|
|
1127
|
+
if (table === undefined) return `coded index tag ${tag} is not defined`;
|
|
1128
|
+
if (row === 0) return `coded index selects row zero in table ${table}`;
|
|
1129
|
+
const count = rowCounts[table] ?? 0;
|
|
1130
|
+
return row > count ? `coded index selects row ${row} in table ${table}, which has ${count} rows` : null;
|
|
1131
|
+
};
|
|
1132
|
+
})))();
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
//#endregion
|
|
1136
|
+
//#region dist/dotnet/ManagedMetadataInventoryRows.js
|
|
1137
|
+
var HAS_CUSTOM_ATTRIBUTE_TABLES, CUSTOM_ATTRIBUTE_TYPE_TABLES, publicKeyIdentity, readModule, readAssembly, readAssemblyReference, readTypeName, declaringTypeForMethod, attributeTypeName, decodeCompressedLength, decodeFixedString, readCustomAttribute, readResource;
|
|
1138
|
+
function init_ManagedMetadataInventoryRows() {
|
|
1139
|
+
return (init_ManagedMetadataInventoryRows = __esmMin((() => {
|
|
1140
|
+
init_ManagedDecodeBudget();
|
|
1141
|
+
init_ManagedMemberOwnership();
|
|
1142
|
+
init_ManagedMetadataLayout();
|
|
1143
|
+
init_ManagedMetadataHeaps();
|
|
1144
|
+
init_ManagedReaderFailure();
|
|
1145
|
+
HAS_CUSTOM_ATTRIBUTE_TABLES = [
|
|
1146
|
+
6,
|
|
1147
|
+
4,
|
|
1148
|
+
1,
|
|
1149
|
+
2,
|
|
1150
|
+
8,
|
|
1151
|
+
9,
|
|
1152
|
+
10,
|
|
1153
|
+
0,
|
|
1154
|
+
14,
|
|
1155
|
+
23,
|
|
1156
|
+
20,
|
|
1157
|
+
17,
|
|
1158
|
+
26,
|
|
1159
|
+
27,
|
|
1160
|
+
32,
|
|
1161
|
+
35,
|
|
1162
|
+
38,
|
|
1163
|
+
39,
|
|
1164
|
+
40,
|
|
1165
|
+
42,
|
|
1166
|
+
44,
|
|
1167
|
+
43
|
|
1168
|
+
];
|
|
1169
|
+
CUSTOM_ATTRIBUTE_TYPE_TABLES = [
|
|
1170
|
+
undefined,
|
|
1171
|
+
undefined,
|
|
1172
|
+
6,
|
|
1173
|
+
10
|
|
1174
|
+
];
|
|
1175
|
+
publicKeyIdentity = (bytes, kind, layout) => ({
|
|
1176
|
+
kind: bytes.length === 0 ? "none" : kind,
|
|
1177
|
+
byte_length: bytes.length,
|
|
1178
|
+
sha256: bytes.length === 0 ? null : managedDecodeBudget(layout).digest(bytes, "sha256"),
|
|
1179
|
+
token: bytes.length === 0 ? null : kind === "public-key" ? Buffer.from(managedDecodeBudget(layout).digest(bytes, "sha1"), "hex").subarray(-8).reverse().toString("hex") : bytes.length === 8 ? bytes.toString("hex") : null
|
|
1180
|
+
});
|
|
1181
|
+
readModule = (bytes, layout, heapExtent) => {
|
|
1182
|
+
const table = layout.table(0);
|
|
1183
|
+
if (table === undefined || table.rowCount === 0) return null;
|
|
1184
|
+
const cursor = metadataRowCursor(bytes, layout, 0, 1);
|
|
1185
|
+
const generation = cursor.readUInt16();
|
|
1186
|
+
const name = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), heapExtent);
|
|
1187
|
+
const mvid = readMetadataGuid(bytes, layout, cursor.readIndex(layout.guidIndexSize));
|
|
1188
|
+
const encId = readMetadataGuid(bytes, layout, cursor.readIndex(layout.guidIndexSize));
|
|
1189
|
+
const encBaseId = readMetadataGuid(bytes, layout, cursor.readIndex(layout.guidIndexSize));
|
|
1190
|
+
return {
|
|
1191
|
+
name,
|
|
1192
|
+
generation,
|
|
1193
|
+
mvid,
|
|
1194
|
+
enc_id: encId,
|
|
1195
|
+
enc_base_id: encBaseId,
|
|
1196
|
+
token: metadataToken(0, 1),
|
|
1197
|
+
row_offset: table.offset
|
|
1198
|
+
};
|
|
1199
|
+
};
|
|
1200
|
+
readAssembly = (bytes, layout, heapExtent) => {
|
|
1201
|
+
const table = layout.table(32);
|
|
1202
|
+
if (table === undefined || table.rowCount === 0) return null;
|
|
1203
|
+
const cursor = metadataRowCursor(bytes, layout, 32, 1);
|
|
1204
|
+
const hashAlgorithm = cursor.readUInt32();
|
|
1205
|
+
const version = [
|
|
1206
|
+
cursor.readUInt16(),
|
|
1207
|
+
cursor.readUInt16(),
|
|
1208
|
+
cursor.readUInt16(),
|
|
1209
|
+
cursor.readUInt16()
|
|
1210
|
+
].join(".");
|
|
1211
|
+
const flags = cursor.readUInt32();
|
|
1212
|
+
const key = readMetadataBlob(bytes, layout, cursor.readIndex(layout.blobIndexSize), heapExtent);
|
|
1213
|
+
const name = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), heapExtent);
|
|
1214
|
+
const culture = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), heapExtent);
|
|
1215
|
+
return {
|
|
1216
|
+
name,
|
|
1217
|
+
version,
|
|
1218
|
+
culture: culture.length === 0 ? null : culture,
|
|
1219
|
+
flags,
|
|
1220
|
+
hash_algorithm: hashAlgorithm,
|
|
1221
|
+
public_key: publicKeyIdentity(key, (flags & 1) === 0 ? "public-key-token" : "public-key", layout),
|
|
1222
|
+
token: metadataToken(32, 1),
|
|
1223
|
+
row_offset: table.offset
|
|
1224
|
+
};
|
|
1225
|
+
};
|
|
1226
|
+
readAssemblyReference = (bytes, layout, row, heapExtent) => {
|
|
1227
|
+
const cursor = metadataRowCursor(bytes, layout, 35, row);
|
|
1228
|
+
const version = [
|
|
1229
|
+
cursor.readUInt16(),
|
|
1230
|
+
cursor.readUInt16(),
|
|
1231
|
+
cursor.readUInt16(),
|
|
1232
|
+
cursor.readUInt16()
|
|
1233
|
+
].join(".");
|
|
1234
|
+
const flags = cursor.readUInt32();
|
|
1235
|
+
const keyOrToken = readMetadataBlob(bytes, layout, cursor.readIndex(layout.blobIndexSize), heapExtent);
|
|
1236
|
+
const name = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), heapExtent);
|
|
1237
|
+
const culture = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), heapExtent);
|
|
1238
|
+
const hashValue = readMetadataBlob(bytes, layout, cursor.readIndex(layout.blobIndexSize), heapExtent);
|
|
1239
|
+
return {
|
|
1240
|
+
name,
|
|
1241
|
+
version,
|
|
1242
|
+
culture: culture.length === 0 ? null : culture,
|
|
1243
|
+
flags,
|
|
1244
|
+
public_key_or_token: publicKeyIdentity(keyOrToken, (flags & 1) === 0 ? "public-key-token" : "public-key", layout),
|
|
1245
|
+
hash_value_sha256: hashValue.length === 0 ? null : managedDecodeBudget(layout).digest(hashValue, "sha256"),
|
|
1246
|
+
hash_value_length: hashValue.length,
|
|
1247
|
+
token: metadataToken(35, row),
|
|
1248
|
+
row_offset: metadataRowOffset(layout, 35, row)
|
|
1249
|
+
};
|
|
1250
|
+
};
|
|
1251
|
+
readTypeName = ({ bytes, layout, table, row, heapExtent }) => {
|
|
1252
|
+
const descriptor = layout.table(table);
|
|
1253
|
+
if (descriptor === undefined || row < 1 || row > descriptor.rowCount) return null;
|
|
1254
|
+
const cursor = metadataRowCursor(bytes, layout, table, row);
|
|
1255
|
+
if (table === 1) cursor.readIndex(layout.codedIndexSize("ResolutionScope"));
|
|
1256
|
+
else cursor.readUInt32();
|
|
1257
|
+
const name = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), heapExtent);
|
|
1258
|
+
const namespace = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), heapExtent);
|
|
1259
|
+
return namespace.length === 0 ? name : `${namespace}.${name}`;
|
|
1260
|
+
};
|
|
1261
|
+
declaringTypeForMethod = (bytes, layout, methodRow, heapExtent, memberLists) => {
|
|
1262
|
+
const owner = memberDeclaringTypeRowLookup(bytes, layout, 6, memberLists)(methodRow);
|
|
1263
|
+
if (owner === 0) return null;
|
|
1264
|
+
return readTypeName({
|
|
1265
|
+
bytes,
|
|
1266
|
+
layout,
|
|
1267
|
+
table: 2,
|
|
1268
|
+
row: owner,
|
|
1269
|
+
heapExtent
|
|
1270
|
+
});
|
|
1271
|
+
};
|
|
1272
|
+
attributeTypeName = (bytes, layout, rawType, heapExtent, memberLists) => {
|
|
1273
|
+
const tag = rawType & 7;
|
|
1274
|
+
const row = Math.floor(rawType / 8);
|
|
1275
|
+
if (row === 0) return null;
|
|
1276
|
+
if (tag === 2) return declaringTypeForMethod(bytes, layout, row, heapExtent, memberLists);
|
|
1277
|
+
if (tag !== 3) return null;
|
|
1278
|
+
const memberRefs = layout.table(10);
|
|
1279
|
+
if (memberRefs === undefined || row > memberRefs.rowCount) return null;
|
|
1280
|
+
const cursor = metadataRowCursor(bytes, layout, 10, row);
|
|
1281
|
+
const parent = cursor.readIndex(layout.codedIndexSize("MemberRefParent"));
|
|
1282
|
+
const parentTag = parent & 7;
|
|
1283
|
+
const parentRow = Math.floor(parent / 8);
|
|
1284
|
+
if (parentTag === 0) return readTypeName({
|
|
1285
|
+
bytes,
|
|
1286
|
+
layout,
|
|
1287
|
+
table: 2,
|
|
1288
|
+
row: parentRow,
|
|
1289
|
+
heapExtent
|
|
1290
|
+
});
|
|
1291
|
+
if (parentTag === 1) return readTypeName({
|
|
1292
|
+
bytes,
|
|
1293
|
+
layout,
|
|
1294
|
+
table: 1,
|
|
1295
|
+
row: parentRow,
|
|
1296
|
+
heapExtent
|
|
1297
|
+
});
|
|
1298
|
+
if (parentTag === 3) return declaringTypeForMethod(bytes, layout, parentRow, heapExtent, memberLists);
|
|
1299
|
+
return null;
|
|
1300
|
+
};
|
|
1301
|
+
decodeCompressedLength = (blob, offset) => {
|
|
1302
|
+
const first = blob[offset];
|
|
1303
|
+
if (first === undefined) return undefined;
|
|
1304
|
+
if ((first & 128) === 0) return {
|
|
1305
|
+
length: first,
|
|
1306
|
+
prefix: 1
|
|
1307
|
+
};
|
|
1308
|
+
if ((first & 192) === 128 && blob[offset + 1] !== undefined) return {
|
|
1309
|
+
length: (first & 63) << 8 | (blob[offset + 1] ?? 0),
|
|
1310
|
+
prefix: 2
|
|
1311
|
+
};
|
|
1312
|
+
if ((first & 224) === 192 && blob[offset + 1] !== undefined && blob[offset + 2] !== undefined && blob[offset + 3] !== undefined) return {
|
|
1313
|
+
length: (first & 31) * 16777216 + (blob[offset + 1] ?? 0) * 65536 + (blob[offset + 2] ?? 0) * 256 + (blob[offset + 3] ?? 0),
|
|
1314
|
+
prefix: 4
|
|
1315
|
+
};
|
|
1316
|
+
return undefined;
|
|
1317
|
+
};
|
|
1318
|
+
decodeFixedString = (blob, layout) => {
|
|
1319
|
+
if (blob.length < 3 || blob.readUInt16LE(0) !== 1 || blob[2] === 255) return null;
|
|
1320
|
+
const length = decodeCompressedLength(blob, 2);
|
|
1321
|
+
if (length === undefined) return null;
|
|
1322
|
+
const start = 2 + length.prefix;
|
|
1323
|
+
if (start > blob.length - length.length) return null;
|
|
1324
|
+
managedDecodeBudget(layout).reserveString(length.length, layout.blob.offset);
|
|
1325
|
+
try {
|
|
1326
|
+
return new TextDecoder("utf-8", {
|
|
1327
|
+
fatal: true,
|
|
1328
|
+
ignoreBOM: true
|
|
1329
|
+
}).decode(blob.subarray(start, start + length.length));
|
|
1330
|
+
} catch (cause) {
|
|
1331
|
+
void cause;
|
|
1332
|
+
return null;
|
|
1333
|
+
}
|
|
1334
|
+
};
|
|
1335
|
+
readCustomAttribute = (bytes, layout, row, heapExtent, issues, memberLists) => {
|
|
1336
|
+
const cursor = metadataRowCursor(bytes, layout, 12, row);
|
|
1337
|
+
const parentRaw = cursor.readIndex(layout.codedIndexSize("HasCustomAttribute"));
|
|
1338
|
+
const typeOffset = cursor.offset;
|
|
1339
|
+
const typeRaw = cursor.readIndex(layout.codedIndexSize("CustomAttributeType"));
|
|
1340
|
+
const value = readMetadataBlob(bytes, layout, cursor.readIndex(layout.blobIndexSize), heapExtent);
|
|
1341
|
+
const parent = metadataCodedToken(parentRaw, 5, HAS_CUSTOM_ATTRIBUTE_TABLES, layout.rowCounts);
|
|
1342
|
+
if (parent === null) {
|
|
1343
|
+
const parentReason = metadataCodedTokenInvalidReason(parentRaw, 5, HAS_CUSTOM_ATTRIBUTE_TABLES, layout.rowCounts);
|
|
1344
|
+
throw managedFailure("invalid-row", `metadata.CustomAttribute:${metadataToken(12, row)}`, `CustomAttribute parent coded index 0x${parentRaw.toString(16)} is invalid${parentReason === null ? " because the required parent is null" : `: ${parentReason}`}`, cursor.start);
|
|
1345
|
+
}
|
|
1346
|
+
const constructor = metadataCodedToken(typeRaw, 3, CUSTOM_ATTRIBUTE_TYPE_TABLES, layout.rowCounts);
|
|
1347
|
+
if (constructor === null) {
|
|
1348
|
+
const typeReason = metadataCodedTokenInvalidReason(typeRaw, 3, CUSTOM_ATTRIBUTE_TYPE_TABLES, layout.rowCounts);
|
|
1349
|
+
issues.push({
|
|
1350
|
+
code: "invalid-row",
|
|
1351
|
+
scope: `metadata.CustomAttribute:${metadataToken(12, row)}`,
|
|
1352
|
+
offset: typeOffset,
|
|
1353
|
+
detail: typeReason === null ? "CustomAttribute constructor coded index 0x0 is null, but Type must reference a MethodDef or MemberRef row" : `CustomAttribute constructor coded index 0x${typeRaw.toString(16)} is invalid: ${typeReason}`
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
let typeName = null;
|
|
1357
|
+
if (constructor !== null) typeName = readManagedValue(() => attributeTypeName(bytes, layout, typeRaw, heapExtent, memberLists), issues) ?? null;
|
|
1358
|
+
return {
|
|
1359
|
+
parent_token: parent,
|
|
1360
|
+
constructor_token: constructor,
|
|
1361
|
+
type_name: typeName,
|
|
1362
|
+
value_length: value.length,
|
|
1363
|
+
value_sha256: managedDecodeBudget(layout).digest(value, "sha256"),
|
|
1364
|
+
decoded_fixed_string: typeName === "System.Runtime.Versioning.TargetFrameworkAttribute" ? decodeFixedString(value, layout) : null,
|
|
1365
|
+
token: metadataToken(12, row),
|
|
1366
|
+
row_offset: cursor.start
|
|
1367
|
+
};
|
|
1368
|
+
};
|
|
1369
|
+
readResource = ({ bytes, layout, row, directory, issues }) => {
|
|
1370
|
+
const cursor = metadataRowCursor(bytes, layout, 40, row);
|
|
1371
|
+
const declaredOffset = cursor.readUInt32();
|
|
1372
|
+
const flags = cursor.readUInt32();
|
|
1373
|
+
const name = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), Math.max(layout.strings.size, layout.blob.size));
|
|
1374
|
+
const implementationOffset = cursor.offset;
|
|
1375
|
+
const implementationRaw = cursor.readIndex(layout.codedIndexSize("Implementation"));
|
|
1376
|
+
const implementationToken = metadataCodedToken(implementationRaw, 2, [
|
|
1377
|
+
38,
|
|
1378
|
+
35,
|
|
1379
|
+
39
|
|
1380
|
+
], layout.rowCounts);
|
|
1381
|
+
const implementationReason = metadataCodedTokenInvalidReason(implementationRaw, 2, [
|
|
1382
|
+
38,
|
|
1383
|
+
35,
|
|
1384
|
+
39
|
|
1385
|
+
], layout.rowCounts);
|
|
1386
|
+
if (implementationReason !== null) issues.push({
|
|
1387
|
+
code: "invalid-row",
|
|
1388
|
+
scope: `metadata.ManifestResource:${metadataToken(40, row)}`,
|
|
1389
|
+
offset: implementationOffset,
|
|
1390
|
+
detail: `ManifestResource implementation coded index 0x${implementationRaw.toString(16)} is invalid: ${implementationReason}`
|
|
1391
|
+
});
|
|
1392
|
+
let dataLength = null;
|
|
1393
|
+
let dataSha256 = null;
|
|
1394
|
+
if (implementationRaw === 0) {
|
|
1395
|
+
if (directory === null || declaredOffset > directory.size - 4) {
|
|
1396
|
+
issues.push({
|
|
1397
|
+
code: "invalid-resource",
|
|
1398
|
+
scope: `metadata.ManifestResource:${metadataToken(40, row)}`,
|
|
1399
|
+
offset: directory?.offset ?? null,
|
|
1400
|
+
detail: "Embedded resource offset leaves the CLI resources directory"
|
|
1401
|
+
});
|
|
1402
|
+
} else {
|
|
1403
|
+
const start = directory.offset + declaredOffset;
|
|
1404
|
+
dataLength = bytes.readUInt32LE(start);
|
|
1405
|
+
if (dataLength > directory.size - declaredOffset - 4) {
|
|
1406
|
+
issues.push({
|
|
1407
|
+
code: "invalid-resource",
|
|
1408
|
+
scope: `metadata.ManifestResource:${metadataToken(40, row)}`,
|
|
1409
|
+
offset: start,
|
|
1410
|
+
detail: "Embedded resource length leaves the CLI resources directory"
|
|
1411
|
+
});
|
|
1412
|
+
} else {
|
|
1413
|
+
dataSha256 = managedDecodeBudget(layout).digest(bytes.subarray(start + 4, start + 4 + dataLength), "sha256");
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
return {
|
|
1418
|
+
name,
|
|
1419
|
+
flags,
|
|
1420
|
+
visibility: (flags & 7) === 1 ? "public" : (flags & 7) === 2 ? "private" : "unknown",
|
|
1421
|
+
implementation_token: implementationToken,
|
|
1422
|
+
embedded: implementationRaw === 0,
|
|
1423
|
+
declared_offset: declaredOffset,
|
|
1424
|
+
data_length: dataLength,
|
|
1425
|
+
data_sha256: dataSha256,
|
|
1426
|
+
token: metadataToken(40, row),
|
|
1427
|
+
row_offset: cursor.start
|
|
1428
|
+
};
|
|
1429
|
+
};
|
|
1430
|
+
})))();
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
//#endregion
|
|
1434
|
+
//#region dist/dotnet/ManagedMetadataInventory.js
|
|
1435
|
+
var readManagedResourceDirectory, readRows, heapExtent, validateIdentityTableCounts, readReferences, readResources, readAttributes, readManagedMetadataInventory, managedTableRowCounts;
|
|
1436
|
+
function init_ManagedMetadataInventory() {
|
|
1437
|
+
return (init_ManagedMetadataInventory = __esmMin((() => {
|
|
1438
|
+
init_ManagedMetadataLayout();
|
|
1439
|
+
init_ManagedMetadataInventoryRows();
|
|
1440
|
+
init_ManagedMetadataHeaps();
|
|
1441
|
+
init_ManagedReaderFailure();
|
|
1442
|
+
readManagedResourceDirectory = (pe, issues) => {
|
|
1443
|
+
const resources = pe.cli?.resources;
|
|
1444
|
+
if (resources === undefined || resources.rva === 0 && resources.size === 0) return null;
|
|
1445
|
+
return readManagedValue(() => ({
|
|
1446
|
+
offset: pe.rvaToOffset(resources.rva, resources.size, "cli.resources"),
|
|
1447
|
+
size: resources.size
|
|
1448
|
+
}), issues) ?? null;
|
|
1449
|
+
};
|
|
1450
|
+
readRows = (descriptor, read) => {
|
|
1451
|
+
const total = descriptor?.rowCount ?? 0;
|
|
1452
|
+
const items = [];
|
|
1453
|
+
for (let index = 0; index < total; index += 1) {
|
|
1454
|
+
const item = read(index + 1);
|
|
1455
|
+
if (item !== undefined) items.push(item);
|
|
1456
|
+
}
|
|
1457
|
+
return items;
|
|
1458
|
+
};
|
|
1459
|
+
heapExtent = (layout) => Math.max(layout.strings.size, layout.blob.size);
|
|
1460
|
+
validateIdentityTableCounts = (layout, issues) => {
|
|
1461
|
+
const moduleRows = layout.table(0)?.rowCount ?? 0;
|
|
1462
|
+
if (moduleRows !== 1) issues.push({
|
|
1463
|
+
code: "invalid-row",
|
|
1464
|
+
scope: "metadata.Module",
|
|
1465
|
+
offset: layout.table(0)?.offset ?? null,
|
|
1466
|
+
detail: `Module table must contain exactly one row; found ${String(moduleRows)}`
|
|
1467
|
+
});
|
|
1468
|
+
const assemblyRows = layout.table(32)?.rowCount ?? 0;
|
|
1469
|
+
if (assemblyRows > 1) issues.push({
|
|
1470
|
+
code: "invalid-row",
|
|
1471
|
+
scope: "metadata.Assembly",
|
|
1472
|
+
offset: layout.table(32)?.offset ?? null,
|
|
1473
|
+
detail: `Assembly table can contain at most one row; found ${String(assemblyRows)}`
|
|
1474
|
+
});
|
|
1475
|
+
};
|
|
1476
|
+
readReferences = (bytes, layout, issues) => {
|
|
1477
|
+
const references = readRows(layout.table(35), (row) => readManagedValue(() => readAssemblyReference(bytes, layout, row, heapExtent(layout)), issues));
|
|
1478
|
+
return {
|
|
1479
|
+
references,
|
|
1480
|
+
referenceNames: [...new Set(references.map(({ name }) => name))].sort()
|
|
1481
|
+
};
|
|
1482
|
+
};
|
|
1483
|
+
readResources = ({ bytes, layout, resourceDirectory, issues }) => readRows(layout.table(40), (row) => readManagedValue(() => readResource({
|
|
1484
|
+
bytes,
|
|
1485
|
+
layout,
|
|
1486
|
+
row,
|
|
1487
|
+
directory: resourceDirectory,
|
|
1488
|
+
issues
|
|
1489
|
+
}), issues));
|
|
1490
|
+
readAttributes = (bytes, layout, issues, memberLists) => {
|
|
1491
|
+
const attributes = readRows(layout.table(12), (row) => readManagedValue(() => readCustomAttribute(bytes, layout, row, heapExtent(layout), issues, memberLists), issues));
|
|
1492
|
+
const targetFrameworks = new Set();
|
|
1493
|
+
for (const attribute of attributes) {
|
|
1494
|
+
if (attribute.parent_token === metadataToken(32, 1) && attribute.type_name === "System.Runtime.Versioning.TargetFrameworkAttribute" && attribute.decoded_fixed_string !== null) targetFrameworks.add(attribute.decoded_fixed_string);
|
|
1495
|
+
}
|
|
1496
|
+
return {
|
|
1497
|
+
attributes,
|
|
1498
|
+
targetFrameworks: [...targetFrameworks].sort()
|
|
1499
|
+
};
|
|
1500
|
+
};
|
|
1501
|
+
readManagedMetadataInventory = (bytes, layout, resourceDirectory, memberLists) => {
|
|
1502
|
+
const issues = [...memberLists.issues];
|
|
1503
|
+
validateIdentityTableCounts(layout, issues);
|
|
1504
|
+
const module = readManagedValue(() => readModule(bytes, layout, heapExtent(layout)), issues) ?? null;
|
|
1505
|
+
const assembly = readManagedValue(() => readAssembly(bytes, layout, heapExtent(layout)), issues) ?? null;
|
|
1506
|
+
const { references, referenceNames } = readReferences(bytes, layout, issues);
|
|
1507
|
+
const resources = readResources({
|
|
1508
|
+
bytes,
|
|
1509
|
+
layout,
|
|
1510
|
+
resourceDirectory,
|
|
1511
|
+
issues
|
|
1512
|
+
});
|
|
1513
|
+
const { attributes, targetFrameworks } = readAttributes(bytes, layout, issues, memberLists);
|
|
1514
|
+
return {
|
|
1515
|
+
module,
|
|
1516
|
+
assembly,
|
|
1517
|
+
targetFrameworks,
|
|
1518
|
+
referenceNames,
|
|
1519
|
+
references,
|
|
1520
|
+
resources,
|
|
1521
|
+
attributes,
|
|
1522
|
+
issues: uniqueManagedParseIssues(issues)
|
|
1523
|
+
};
|
|
1524
|
+
};
|
|
1525
|
+
managedTableRowCounts = (layout) => Object.fromEntries([...layout.tables.values()].map(({ index, rowCount }) => [METADATA_TABLE_NAMES[index] ?? `Table${String(index)}`, rowCount]));
|
|
1526
|
+
})))();
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
//#endregion
|
|
1530
|
+
//#region dist/dotnet/ManagedMemberInspectorCore.js
|
|
1531
|
+
var rowRange, fullName, readTypeRange, typeRanges, parseTypes, readCompressed, ELEMENT_TYPES, readSignedCompressed, malformedSignature, MEMBER_METHOD_HEADERS, FUNCTION_POINTER_CONVENTIONS, readMethodSignatureHeader, MAX_ARRAY_RANK, arrayShape, currentPosition, POSITION_ELEMENTS, readTypeOperand, readTypeSignature, CALLING_CONVENTION_NAMES, callingConvention, specSignature, decodeSignature, methodGenericArity, signatureGenericArity, signature;
|
|
1532
|
+
function init_ManagedMemberInspectorCore() {
|
|
1533
|
+
return (init_ManagedMemberInspectorCore = __esmMin((() => {
|
|
1534
|
+
init_ManagedReaderFailure();
|
|
1535
|
+
init_ManagedDecodeBudget();
|
|
1536
|
+
init_ManagedMetadataHeaps();
|
|
1537
|
+
init_ManagedMemberPointers();
|
|
1538
|
+
rowRange = (table, start, end) => {
|
|
1539
|
+
const total = table?.rowCount ?? 0;
|
|
1540
|
+
if (start === null || end === null) return {
|
|
1541
|
+
first: null,
|
|
1542
|
+
last: null,
|
|
1543
|
+
count: 0
|
|
1544
|
+
};
|
|
1545
|
+
const lastExclusive = Math.min(end, total + 1);
|
|
1546
|
+
if (start >= lastExclusive) return {
|
|
1547
|
+
first: null,
|
|
1548
|
+
last: null,
|
|
1549
|
+
count: 0
|
|
1550
|
+
};
|
|
1551
|
+
return {
|
|
1552
|
+
first: start,
|
|
1553
|
+
last: lastExclusive - 1,
|
|
1554
|
+
count: lastExclusive - start
|
|
1555
|
+
};
|
|
1556
|
+
};
|
|
1557
|
+
fullName = (namespace, name) => namespace.length === 0 ? name : `${namespace}.${name}`;
|
|
1558
|
+
readTypeRange = (bytes, layout, row, issues, memberLists) => {
|
|
1559
|
+
const cursor = metadataRowCursor(bytes, layout, 2, row);
|
|
1560
|
+
cursor.readUInt32();
|
|
1561
|
+
const nameIndex = cursor.readIndex(layout.stringIndexSize);
|
|
1562
|
+
const namespaceIndex = cursor.readIndex(layout.stringIndexSize);
|
|
1563
|
+
const declaredName = readManagedValue(() => fullName(readMetadataString(bytes, layout, namespaceIndex, layout.strings.size), readMetadataString(bytes, layout, nameIndex, layout.strings.size)), issues) ?? null;
|
|
1564
|
+
cursor.readIndex(layout.codedIndexSize("TypeDefOrRef"));
|
|
1565
|
+
const current = memberLists.entries[row - 1];
|
|
1566
|
+
return {
|
|
1567
|
+
token: metadataToken(2, row),
|
|
1568
|
+
fullName: declaredName,
|
|
1569
|
+
fieldStart: current?.field.start.value ?? null,
|
|
1570
|
+
fieldEnd: current?.field.end ?? null,
|
|
1571
|
+
methodStart: current?.method.start.value ?? null,
|
|
1572
|
+
methodEnd: current?.method.end ?? null
|
|
1573
|
+
};
|
|
1574
|
+
};
|
|
1575
|
+
typeRanges = (bytes, layout, issues, memberLists) => {
|
|
1576
|
+
issues.push(...memberLists.issues);
|
|
1577
|
+
const typeTable = layout.table(2);
|
|
1578
|
+
const ranges = [];
|
|
1579
|
+
for (let row = 1; row <= (typeTable?.rowCount ?? 0); row += 1) ranges.push(readTypeRange(bytes, layout, row, issues, memberLists));
|
|
1580
|
+
return ranges;
|
|
1581
|
+
};
|
|
1582
|
+
parseTypes = (bytes, layout, ranges) => {
|
|
1583
|
+
const typeTable = layout.table(2);
|
|
1584
|
+
const fields = memberListTable(layout, 4);
|
|
1585
|
+
const methods = memberListTable(layout, 6);
|
|
1586
|
+
const items = [];
|
|
1587
|
+
const issues = [];
|
|
1588
|
+
for (let row = 1; row <= (typeTable?.rowCount ?? 0); row += 1) {
|
|
1589
|
+
readManagedValue(() => {
|
|
1590
|
+
const cursor = metadataRowCursor(bytes, layout, 2, row);
|
|
1591
|
+
const flags = cursor.readUInt32();
|
|
1592
|
+
const name = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), layout.strings.size);
|
|
1593
|
+
const namespace = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), layout.strings.size);
|
|
1594
|
+
const extendsOffset = cursor.offset;
|
|
1595
|
+
const extendsRaw = cursor.readIndex(layout.codedIndexSize("TypeDefOrRef"));
|
|
1596
|
+
const currentRange = ranges[row - 1] ?? null;
|
|
1597
|
+
const fieldRange = rowRange(fields, currentRange?.fieldStart ?? null, currentRange?.fieldEnd ?? null);
|
|
1598
|
+
const methodRange = rowRange(methods, currentRange?.methodStart ?? null, currentRange?.methodEnd ?? null);
|
|
1599
|
+
const extendsReason = metadataCodedTokenInvalidReason(extendsRaw, 2, [
|
|
1600
|
+
2,
|
|
1601
|
+
1,
|
|
1602
|
+
27
|
|
1603
|
+
], layout.rowCounts);
|
|
1604
|
+
if (extendsReason !== null) issues.push({
|
|
1605
|
+
code: "invalid-row",
|
|
1606
|
+
scope: `metadata.TypeDef:${metadataToken(2, row)}`,
|
|
1607
|
+
offset: extendsOffset,
|
|
1608
|
+
detail: `TypeDef Extends coded index 0x${extendsRaw.toString(16)} is invalid: ${extendsReason}`
|
|
1609
|
+
});
|
|
1610
|
+
items.push({
|
|
1611
|
+
token: metadataToken(2, row),
|
|
1612
|
+
row_offset: cursor.start,
|
|
1613
|
+
namespace,
|
|
1614
|
+
name,
|
|
1615
|
+
full_name: fullName(namespace, name),
|
|
1616
|
+
flags,
|
|
1617
|
+
extends_token: metadataCodedToken(extendsRaw, 2, [
|
|
1618
|
+
2,
|
|
1619
|
+
1,
|
|
1620
|
+
27
|
|
1621
|
+
], layout.rowCounts),
|
|
1622
|
+
field_list: {
|
|
1623
|
+
first_row: fieldRange.first,
|
|
1624
|
+
last_row: fieldRange.last,
|
|
1625
|
+
count: fieldRange.count
|
|
1626
|
+
},
|
|
1627
|
+
method_list: {
|
|
1628
|
+
first_row: methodRange.first,
|
|
1629
|
+
last_row: methodRange.last,
|
|
1630
|
+
count: methodRange.count
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1633
|
+
}, issues);
|
|
1634
|
+
}
|
|
1635
|
+
return {
|
|
1636
|
+
types: items,
|
|
1637
|
+
issues
|
|
1638
|
+
};
|
|
1639
|
+
};
|
|
1640
|
+
readCompressed = (bytes, offset) => {
|
|
1641
|
+
const first = bytes[offset];
|
|
1642
|
+
if (first === undefined) throw managedFailure("invalid-blob", "signature", "truncated compressed integer", offset);
|
|
1643
|
+
if ((first & 128) === 0) return {
|
|
1644
|
+
value: first,
|
|
1645
|
+
next: offset + 1
|
|
1646
|
+
};
|
|
1647
|
+
const second = bytes[offset + 1];
|
|
1648
|
+
if ((first & 192) === 128 && second !== undefined) return {
|
|
1649
|
+
value: (first & 63) << 8 | second,
|
|
1650
|
+
next: offset + 2
|
|
1651
|
+
};
|
|
1652
|
+
const b1 = bytes[offset + 1];
|
|
1653
|
+
const b2 = bytes[offset + 2];
|
|
1654
|
+
const b3 = bytes[offset + 3];
|
|
1655
|
+
if ((first & 224) === 192 && b1 !== undefined && b2 !== undefined && b3 !== undefined) return {
|
|
1656
|
+
value: (first & 31) * 16777216 + b1 * 65536 + b2 * 256 + b3,
|
|
1657
|
+
next: offset + 4
|
|
1658
|
+
};
|
|
1659
|
+
throw managedFailure("invalid-blob", "signature", "reserved compressed integer", offset);
|
|
1660
|
+
};
|
|
1661
|
+
ELEMENT_TYPES = new Map([
|
|
1662
|
+
[1, "void"],
|
|
1663
|
+
[2, "bool"],
|
|
1664
|
+
[3, "char"],
|
|
1665
|
+
[4, "i1"],
|
|
1666
|
+
[5, "u1"],
|
|
1667
|
+
[6, "i2"],
|
|
1668
|
+
[7, "u2"],
|
|
1669
|
+
[8, "i4"],
|
|
1670
|
+
[9, "u4"],
|
|
1671
|
+
[10, "i8"],
|
|
1672
|
+
[11, "u8"],
|
|
1673
|
+
[12, "r4"],
|
|
1674
|
+
[13, "r8"],
|
|
1675
|
+
[14, "string"],
|
|
1676
|
+
[24, "native-int"],
|
|
1677
|
+
[25, "native-uint"],
|
|
1678
|
+
[28, "object"]
|
|
1679
|
+
]);
|
|
1680
|
+
readSignedCompressed = (bytes, offset) => {
|
|
1681
|
+
const encoded = readCompressed(bytes, offset);
|
|
1682
|
+
const width = encoded.next - offset === 1 ? 7 : encoded.next - offset === 2 ? 14 : 29;
|
|
1683
|
+
const magnitude = Math.floor(encoded.value / 2);
|
|
1684
|
+
return {
|
|
1685
|
+
value: encoded.value % 2 === 0 ? magnitude : magnitude - 2 ** (width - 1),
|
|
1686
|
+
next: encoded.next
|
|
1687
|
+
};
|
|
1688
|
+
};
|
|
1689
|
+
malformedSignature = (detail, offset) => {
|
|
1690
|
+
throw managedFailure("invalid-blob", "signature", detail, offset);
|
|
1691
|
+
};
|
|
1692
|
+
MEMBER_METHOD_HEADERS = new Set([
|
|
1693
|
+
0,
|
|
1694
|
+
5,
|
|
1695
|
+
16
|
|
1696
|
+
]);
|
|
1697
|
+
FUNCTION_POINTER_CONVENTIONS = new Set([
|
|
1698
|
+
0,
|
|
1699
|
+
1,
|
|
1700
|
+
2,
|
|
1701
|
+
3,
|
|
1702
|
+
4,
|
|
1703
|
+
5,
|
|
1704
|
+
9
|
|
1705
|
+
]);
|
|
1706
|
+
readMethodSignatureHeader = (blob, offset, context) => {
|
|
1707
|
+
const first = blob[offset];
|
|
1708
|
+
if (first === undefined) return malformedSignature("truncated method signature", offset);
|
|
1709
|
+
const allowed = context === "member" ? MEMBER_METHOD_HEADERS.has(first & 159) : (first & 128) === 0 && FUNCTION_POINTER_CONVENTIONS.has(first & 15);
|
|
1710
|
+
if (!allowed || (first & 64) !== 0 && (first & 32) === 0) return malformedSignature(`calling convention 0x${first.toString(16)} does not head a ${context} method signature`, offset);
|
|
1711
|
+
let next = offset + 1;
|
|
1712
|
+
let genericParameterCount = null;
|
|
1713
|
+
if ((first & 16) !== 0) {
|
|
1714
|
+
const generic = readCompressed(blob, next);
|
|
1715
|
+
genericParameterCount = generic.value;
|
|
1716
|
+
next = generic.next;
|
|
1717
|
+
}
|
|
1718
|
+
const parameterCount = readCompressed(blob, next);
|
|
1719
|
+
return {
|
|
1720
|
+
first,
|
|
1721
|
+
genericParameterCount,
|
|
1722
|
+
parameterCount: parameterCount.value,
|
|
1723
|
+
next: parameterCount.next
|
|
1724
|
+
};
|
|
1725
|
+
};
|
|
1726
|
+
MAX_ARRAY_RANK = 32;
|
|
1727
|
+
arrayShape = (blob, offset) => {
|
|
1728
|
+
const rank = readCompressed(blob, offset);
|
|
1729
|
+
if (rank.value === 0) return malformedSignature("array rank is zero", offset);
|
|
1730
|
+
if (rank.value > MAX_ARRAY_RANK) throw managedFailure("unsupported-signature", "signature", `array rank ${String(rank.value)} exceeds the ${String(MAX_ARRAY_RANK)} dimensions the CLR supports`, offset);
|
|
1731
|
+
const sizeCount = readCompressed(blob, rank.next);
|
|
1732
|
+
if (sizeCount.value > rank.value) return malformedSignature("array has more sizes than dimensions", offset);
|
|
1733
|
+
const sizes = [];
|
|
1734
|
+
let next = sizeCount.next;
|
|
1735
|
+
for (let index = 0; index < sizeCount.value; index += 1) {
|
|
1736
|
+
const size = readCompressed(blob, next);
|
|
1737
|
+
sizes.push(size.value);
|
|
1738
|
+
next = size.next;
|
|
1739
|
+
}
|
|
1740
|
+
const boundCount = readCompressed(blob, next);
|
|
1741
|
+
if (boundCount.value > rank.value) return malformedSignature("array has more lower bounds than dimensions", offset);
|
|
1742
|
+
const lowerBounds = [];
|
|
1743
|
+
next = boundCount.next;
|
|
1744
|
+
for (let index = 0; index < boundCount.value; index += 1) {
|
|
1745
|
+
const bound = readSignedCompressed(blob, next);
|
|
1746
|
+
lowerBounds.push(bound.value);
|
|
1747
|
+
next = bound.next;
|
|
1748
|
+
}
|
|
1749
|
+
const dimensions = Array.from({ length: rank.value }, (_, index) => {
|
|
1750
|
+
const size = sizes[index];
|
|
1751
|
+
const lower = lowerBounds[index];
|
|
1752
|
+
if (lower !== undefined) return size === undefined ? `${String(lower)}...` : `${String(lower)}...${String(lower + size - 1)}`;
|
|
1753
|
+
if (size !== undefined) return String(size);
|
|
1754
|
+
return rank.value === 1 ? "..." : "";
|
|
1755
|
+
});
|
|
1756
|
+
return {
|
|
1757
|
+
value: `[${dimensions.join(",")}]`,
|
|
1758
|
+
next
|
|
1759
|
+
};
|
|
1760
|
+
};
|
|
1761
|
+
currentPosition = (stack, base) => {
|
|
1762
|
+
const frame = stack.findLast(({ kind }) => kind !== "modifiers");
|
|
1763
|
+
if (frame === undefined) return base;
|
|
1764
|
+
if (frame.kind === "suffix") return frame.suffix === "*" ? "pointee" : "type";
|
|
1765
|
+
if (frame.kind === "list" && frame.signatureItems) return frame.items.length === 0 ? "return" : "parameter";
|
|
1766
|
+
return "type";
|
|
1767
|
+
};
|
|
1768
|
+
POSITION_ELEMENTS = new Map([
|
|
1769
|
+
[1, ["return", "pointee"]],
|
|
1770
|
+
[22, ["return", "parameter"]],
|
|
1771
|
+
[16, [
|
|
1772
|
+
"return",
|
|
1773
|
+
"parameter",
|
|
1774
|
+
"field"
|
|
1775
|
+
]]
|
|
1776
|
+
]);
|
|
1777
|
+
readTypeOperand = (blob, offset, layout, tables = [
|
|
1778
|
+
2,
|
|
1779
|
+
1,
|
|
1780
|
+
27
|
|
1781
|
+
]) => {
|
|
1782
|
+
const token = readCompressed(blob, offset);
|
|
1783
|
+
if (layout !== undefined) {
|
|
1784
|
+
const reason = token.value === 0 ? "type operand is null" : metadataCodedTokenInvalidReason(token.value, 2, tables, layout.rowCounts);
|
|
1785
|
+
if (reason !== null) throw managedFailure("invalid-row", "signature", `TypeDefOrRefOrSpec operand 0x${token.value.toString(16)} is invalid: ${reason}`, offset);
|
|
1786
|
+
}
|
|
1787
|
+
return token;
|
|
1788
|
+
};
|
|
1789
|
+
readTypeSignature = (blob, offset, base, layout) => {
|
|
1790
|
+
const stack = [];
|
|
1791
|
+
let cursor = offset;
|
|
1792
|
+
for (;;) {
|
|
1793
|
+
let value;
|
|
1794
|
+
const kind = blob[cursor];
|
|
1795
|
+
if (kind === undefined) return malformedSignature("truncated type signature", cursor);
|
|
1796
|
+
const positions = POSITION_ELEMENTS.get(kind);
|
|
1797
|
+
if (positions !== undefined && !positions.includes(currentPosition(stack, base))) return malformedSignature(`element type 0x${kind.toString(16)} is not valid in a ${currentPosition(stack, base)} position`, cursor);
|
|
1798
|
+
const named = ELEMENT_TYPES.get(kind);
|
|
1799
|
+
if (named !== undefined) {
|
|
1800
|
+
value = named;
|
|
1801
|
+
cursor += 1;
|
|
1802
|
+
} else if (kind === 15 || kind === 16 || kind === 29) {
|
|
1803
|
+
const suffix = kind === 15 ? "*" : kind === 16 ? "&" : "[]";
|
|
1804
|
+
stack.push({
|
|
1805
|
+
kind: "suffix",
|
|
1806
|
+
suffix
|
|
1807
|
+
});
|
|
1808
|
+
cursor += 1;
|
|
1809
|
+
} else if (kind === 31 || kind === 32) {
|
|
1810
|
+
const token = readTypeOperand(blob, cursor + 1, layout);
|
|
1811
|
+
const modifier = `${kind === 31 ? "modreq" : "modopt"}:${String(token.value)}`;
|
|
1812
|
+
const top = stack.at(-1);
|
|
1813
|
+
if (top?.kind === "modifiers") top.modifiers.push(modifier);
|
|
1814
|
+
else stack.push({
|
|
1815
|
+
kind: "modifiers",
|
|
1816
|
+
modifiers: [modifier]
|
|
1817
|
+
});
|
|
1818
|
+
cursor = token.next;
|
|
1819
|
+
} else if (kind === 17 || kind === 18) {
|
|
1820
|
+
const token = readTypeOperand(blob, cursor + 1, layout);
|
|
1821
|
+
value = `${kind === 17 ? "valuetype" : "class"}:${String(token.value)}`;
|
|
1822
|
+
cursor = token.next;
|
|
1823
|
+
} else if (kind === 30 || kind === 19) {
|
|
1824
|
+
const variable = readCompressed(blob, cursor + 1);
|
|
1825
|
+
value = `${kind === 30 ? "mvar" : "var"}:${String(variable.value)}`;
|
|
1826
|
+
cursor = variable.next;
|
|
1827
|
+
} else if (kind === 22) {
|
|
1828
|
+
value = "typedbyref";
|
|
1829
|
+
cursor += 1;
|
|
1830
|
+
} else if (kind === 20) {
|
|
1831
|
+
stack.push({ kind: "array" });
|
|
1832
|
+
cursor += 1;
|
|
1833
|
+
} else if (kind === 21) {
|
|
1834
|
+
const generic = blob[cursor + 1];
|
|
1835
|
+
if (generic !== 17 && generic !== 18) return malformedSignature("generic instantiation does not name a class or value type", cursor + 1);
|
|
1836
|
+
const token = readTypeOperand(blob, cursor + 2, layout, [2, 1]);
|
|
1837
|
+
const argumentCount = readCompressed(blob, token.next);
|
|
1838
|
+
if (argumentCount.value === 0) return malformedSignature("generic instantiation has no type arguments", token.next);
|
|
1839
|
+
const head = `${generic === 17 ? "valuetype" : "class"}:${String(token.value)}`;
|
|
1840
|
+
stack.push({
|
|
1841
|
+
kind: "list",
|
|
1842
|
+
remaining: argumentCount.value,
|
|
1843
|
+
items: [],
|
|
1844
|
+
signatureItems: false,
|
|
1845
|
+
render: (items) => `${head}<${items.join(",")}>`
|
|
1846
|
+
});
|
|
1847
|
+
cursor = argumentCount.next;
|
|
1848
|
+
} else if (kind === 27) {
|
|
1849
|
+
const header = readMethodSignatureHeader(blob, cursor + 1, "function-pointer");
|
|
1850
|
+
const convention = callingConvention(header.first);
|
|
1851
|
+
const head = header.genericParameterCount === null ? convention : `${convention};${String(header.genericParameterCount)}`;
|
|
1852
|
+
stack.push({
|
|
1853
|
+
kind: "list",
|
|
1854
|
+
remaining: header.parameterCount + 1,
|
|
1855
|
+
items: [],
|
|
1856
|
+
signatureItems: true,
|
|
1857
|
+
render: ([returnType, ...parameters]) => `fnptr[${head}](${parameters.join(",")})->${returnType ?? ""}`
|
|
1858
|
+
});
|
|
1859
|
+
cursor = header.next;
|
|
1860
|
+
} else {
|
|
1861
|
+
throw managedFailure("unsupported-signature", "signature", `unsupported element type 0x${kind.toString(16)}`, cursor);
|
|
1862
|
+
}
|
|
1863
|
+
while (value !== undefined) {
|
|
1864
|
+
const top = stack.pop();
|
|
1865
|
+
if (top === undefined) return {
|
|
1866
|
+
value,
|
|
1867
|
+
next: cursor
|
|
1868
|
+
};
|
|
1869
|
+
if (top.kind === "suffix") value += top.suffix;
|
|
1870
|
+
else if (top.kind === "modifiers") value = `${value} ${top.modifiers.join(" ")}`;
|
|
1871
|
+
else if (top.kind === "array") {
|
|
1872
|
+
const shape = arrayShape(blob, cursor);
|
|
1873
|
+
value += shape.value;
|
|
1874
|
+
cursor = shape.next;
|
|
1875
|
+
} else {
|
|
1876
|
+
top.items.push(value);
|
|
1877
|
+
top.remaining -= 1;
|
|
1878
|
+
if (top.remaining === 0) value = top.render(top.items);
|
|
1879
|
+
else {
|
|
1880
|
+
value = undefined;
|
|
1881
|
+
stack.push(top);
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
};
|
|
1887
|
+
CALLING_CONVENTION_NAMES = new Map([
|
|
1888
|
+
[0, "default"],
|
|
1889
|
+
[1, "c"],
|
|
1890
|
+
[2, "stdcall"],
|
|
1891
|
+
[3, "thiscall"],
|
|
1892
|
+
[4, "fastcall"],
|
|
1893
|
+
[5, "vararg"],
|
|
1894
|
+
[6, "field"],
|
|
1895
|
+
[9, "unmanaged"]
|
|
1896
|
+
]);
|
|
1897
|
+
callingConvention = (value) => {
|
|
1898
|
+
const base = value & 15;
|
|
1899
|
+
const flags = [
|
|
1900
|
+
(value & 32) === 0 ? null : "has-this",
|
|
1901
|
+
(value & 64) === 0 ? null : "explicit-this",
|
|
1902
|
+
(value & 16) === 0 ? null : "generic"
|
|
1903
|
+
].filter((flag) => flag !== null);
|
|
1904
|
+
const name = CALLING_CONVENTION_NAMES.get(base) ?? `unknown:${String(base)}`;
|
|
1905
|
+
return flags.length === 0 ? name : `${name} ${flags.join(" ")}`;
|
|
1906
|
+
};
|
|
1907
|
+
specSignature = (layout, blob, owner) => {
|
|
1908
|
+
const budget = managedDecodeBudget(layout);
|
|
1909
|
+
budget.admitTransient(blob.length * 256, owner.offset);
|
|
1910
|
+
try {
|
|
1911
|
+
let cursor = 0;
|
|
1912
|
+
let count = 1;
|
|
1913
|
+
if (owner.form === "instantiation") {
|
|
1914
|
+
if (blob[0] !== 10) malformedSignature("MethodSpec instantiation is not GENERICINST", 0);
|
|
1915
|
+
const header = readCompressed(blob, 1);
|
|
1916
|
+
if (header.value === 0) malformedSignature("MethodSpec instantiation has no type arguments", 1);
|
|
1917
|
+
count = header.value;
|
|
1918
|
+
cursor = header.next;
|
|
1919
|
+
}
|
|
1920
|
+
const types = [];
|
|
1921
|
+
for (let index = 0; index < count; index += 1) {
|
|
1922
|
+
const type = readTypeSignature(blob, cursor, "type", layout);
|
|
1923
|
+
types.push(type.value);
|
|
1924
|
+
cursor = type.next;
|
|
1925
|
+
}
|
|
1926
|
+
if (cursor !== blob.length) malformedSignature("Trailing signature data", cursor);
|
|
1927
|
+
return types;
|
|
1928
|
+
} catch (cause) {
|
|
1929
|
+
if (!(cause instanceof ManagedReaderFailure) || cause.issue.code !== "invalid-blob" && cause.issue.code !== "invalid-row" && cause.issue.code !== "unsupported-signature") throw cause;
|
|
1930
|
+
throw managedFailure(cause.issue.code, owner.scope, cause.issue.detail, owner.offset);
|
|
1931
|
+
} finally {
|
|
1932
|
+
budget.releaseTransient();
|
|
1933
|
+
}
|
|
1934
|
+
};
|
|
1935
|
+
decodeSignature = (blob) => {
|
|
1936
|
+
try {
|
|
1937
|
+
if (blob.length === 0) throw managedFailure("invalid-blob", "signature", "empty signature", 0);
|
|
1938
|
+
const first = blob[0] ?? 0;
|
|
1939
|
+
if (first === 6) {
|
|
1940
|
+
const fieldType = readTypeSignature(blob, 1, "field");
|
|
1941
|
+
return {
|
|
1942
|
+
kind: "field",
|
|
1943
|
+
parse_status: fieldType.next === blob.length ? "decoded" : "partial",
|
|
1944
|
+
calling_convention: callingConvention(first),
|
|
1945
|
+
generic_parameter_count: null,
|
|
1946
|
+
parameter_count: null,
|
|
1947
|
+
return_type: null,
|
|
1948
|
+
parameter_types: [],
|
|
1949
|
+
field_type: fieldType.value,
|
|
1950
|
+
issue: fieldType.next === blob.length ? null : "Trailing signature data"
|
|
1951
|
+
};
|
|
1952
|
+
}
|
|
1953
|
+
const header = readMethodSignatureHeader(blob, 0, "member");
|
|
1954
|
+
const returnType = readTypeSignature(blob, header.next, "return");
|
|
1955
|
+
let offset = returnType.next;
|
|
1956
|
+
const parameters = [];
|
|
1957
|
+
for (let index = 0; index < header.parameterCount; index += 1) {
|
|
1958
|
+
const parameter = readTypeSignature(blob, offset, "parameter");
|
|
1959
|
+
parameters.push(parameter.value);
|
|
1960
|
+
offset = parameter.next;
|
|
1961
|
+
}
|
|
1962
|
+
return {
|
|
1963
|
+
kind: "method",
|
|
1964
|
+
parse_status: offset === blob.length ? "decoded" : "partial",
|
|
1965
|
+
calling_convention: callingConvention(first),
|
|
1966
|
+
generic_parameter_count: header.genericParameterCount,
|
|
1967
|
+
parameter_count: header.parameterCount,
|
|
1968
|
+
return_type: returnType.value,
|
|
1969
|
+
parameter_types: parameters,
|
|
1970
|
+
field_type: null,
|
|
1971
|
+
issue: offset === blob.length ? null : "Trailing signature data"
|
|
1972
|
+
};
|
|
1973
|
+
} catch (cause) {
|
|
1974
|
+
if (!(cause instanceof ManagedReaderFailure)) throw cause;
|
|
1975
|
+
if (cause.issue.code !== "invalid-blob" && cause.issue.code !== "unsupported-signature") throw cause;
|
|
1976
|
+
return {
|
|
1977
|
+
kind: "unknown",
|
|
1978
|
+
parse_status: cause.issue.code === "unsupported-signature" ? "unsupported" : "malformed",
|
|
1979
|
+
calling_convention: null,
|
|
1980
|
+
generic_parameter_count: null,
|
|
1981
|
+
parameter_count: null,
|
|
1982
|
+
return_type: null,
|
|
1983
|
+
parameter_types: [],
|
|
1984
|
+
field_type: null,
|
|
1985
|
+
issue: cause.issue.detail
|
|
1986
|
+
};
|
|
1987
|
+
}
|
|
1988
|
+
};
|
|
1989
|
+
methodGenericArity = (layout, blob) => {
|
|
1990
|
+
const budget = managedDecodeBudget(layout);
|
|
1991
|
+
budget.admitTransient(blob.length * 256, layout.blob.offset);
|
|
1992
|
+
try {
|
|
1993
|
+
return signatureGenericArity(decodeSignature(blob));
|
|
1994
|
+
} finally {
|
|
1995
|
+
budget.releaseTransient();
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
signatureGenericArity = (decoded) => decoded.kind === "method" && decoded.parse_status === "decoded" ? decoded.generic_parameter_count ?? 0 : null;
|
|
1999
|
+
signature = (blob, rawSha256) => ({
|
|
2000
|
+
raw_length: blob.length,
|
|
2001
|
+
raw_sha256: rawSha256 ?? sha256Bytes(blob),
|
|
2002
|
+
...decodeSignature(blob)
|
|
2003
|
+
});
|
|
2004
|
+
})))();
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
//#endregion
|
|
2008
|
+
//#region dist/dotnet/ManagedMethodSpecs.js
|
|
2009
|
+
var edgeTargets, readMethodSpec, methodSignatureBlob;
|
|
2010
|
+
function init_ManagedMethodSpecs() {
|
|
2011
|
+
return (init_ManagedMethodSpecs = __esmMin((() => {
|
|
2012
|
+
init_ManagedMemberInspectorCore();
|
|
2013
|
+
init_ManagedMetadataHeaps();
|
|
2014
|
+
init_ManagedReaderFailure();
|
|
2015
|
+
edgeTargets = (bytes, layout, methods, cores) => {
|
|
2016
|
+
const members = new Map(cores.flatMap((core) => [...core]));
|
|
2017
|
+
const issues = [];
|
|
2018
|
+
const seen = new Set();
|
|
2019
|
+
const arities = new Map();
|
|
2020
|
+
for (const method of methods) for (const { operand } of method.body.anchors) {
|
|
2021
|
+
if (operand?.startsWith("0x2b") !== true || seen.has(operand)) continue;
|
|
2022
|
+
seen.add(operand);
|
|
2023
|
+
readManagedValue(() => readMethodSpec({
|
|
2024
|
+
bytes,
|
|
2025
|
+
layout,
|
|
2026
|
+
members,
|
|
2027
|
+
issues,
|
|
2028
|
+
arities
|
|
2029
|
+
}, operand), issues);
|
|
2030
|
+
}
|
|
2031
|
+
return {
|
|
2032
|
+
members,
|
|
2033
|
+
issues
|
|
2034
|
+
};
|
|
2035
|
+
};
|
|
2036
|
+
readMethodSpec = ({ bytes, layout, members, issues, arities }, token) => {
|
|
2037
|
+
const scope = `metadata.MethodSpec:${token}`;
|
|
2038
|
+
const cursor = metadataRowCursor(bytes, layout, 43, Number.parseInt(token.slice(4), 16));
|
|
2039
|
+
const methodRaw = cursor.readIndex(layout.codedIndexSize("MethodDefOrRef"));
|
|
2040
|
+
const instantiation = cursor.readIndex(layout.blobIndexSize);
|
|
2041
|
+
const methodReason = metadataCodedTokenInvalidReason(methodRaw, 1, [6, 10], layout.rowCounts);
|
|
2042
|
+
if (methodReason !== null || methodRaw === 0) issues.push({
|
|
2043
|
+
code: "invalid-row",
|
|
2044
|
+
scope,
|
|
2045
|
+
offset: cursor.start,
|
|
2046
|
+
detail: methodReason === null ? "MethodSpec method coded index 0x0 is null, but the Method column must reference a row" : `MethodSpec method coded index 0x${methodRaw.toString(16)} is invalid: ${methodReason}`
|
|
2047
|
+
});
|
|
2048
|
+
const generic = metadataCodedToken(methodRaw, 1, [6, 10], layout.rowCounts);
|
|
2049
|
+
const target = generic === null ? undefined : members.get(generic);
|
|
2050
|
+
if (target !== undefined && target.kind !== "field") members.set(token, {
|
|
2051
|
+
...target,
|
|
2052
|
+
token
|
|
2053
|
+
});
|
|
2054
|
+
const types = specSignature(layout, readMetadataBlob(bytes, layout, instantiation, layout.blob.size), {
|
|
2055
|
+
form: "instantiation",
|
|
2056
|
+
scope,
|
|
2057
|
+
offset: cursor.start
|
|
2058
|
+
});
|
|
2059
|
+
if (generic === null) return;
|
|
2060
|
+
if (target?.genericArity === undefined && !arities.has(generic)) arities.set(generic, methodGenericArity(layout, methodSignatureBlob(bytes, layout, generic)));
|
|
2061
|
+
const arity = target?.genericArity === undefined ? arities.get(generic) ?? null : target.genericArity;
|
|
2062
|
+
if (arity !== types.length) throw managedFailure("invalid-row", scope, arity === null ? "MethodSpec method does not have a decodable method signature" : `MethodSpec supplies ${String(types.length)} type argument(s), but its method declares ${String(arity)} generic parameter(s)`, cursor.start);
|
|
2063
|
+
};
|
|
2064
|
+
methodSignatureBlob = (bytes, layout, token) => {
|
|
2065
|
+
const table = Number.parseInt(token.slice(2, 4), 16);
|
|
2066
|
+
const cursor = metadataRowCursor(bytes, layout, table, Number.parseInt(token.slice(4), 16));
|
|
2067
|
+
if (table === 6) {
|
|
2068
|
+
cursor.readUInt32();
|
|
2069
|
+
cursor.readUInt16();
|
|
2070
|
+
cursor.readUInt16();
|
|
2071
|
+
} else cursor.readIndex(layout.codedIndexSize("MemberRefParent"));
|
|
2072
|
+
cursor.readIndex(layout.stringIndexSize);
|
|
2073
|
+
return readMetadataBlob(bytes, layout, cursor.readIndex(layout.blobIndexSize), layout.blob.size);
|
|
2074
|
+
};
|
|
2075
|
+
})))();
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
//#endregion
|
|
2079
|
+
//#region dist/dotnet/ManagedTypeNames.js
|
|
2080
|
+
var typeNameLookup;
|
|
2081
|
+
function init_ManagedTypeNames() {
|
|
2082
|
+
return (init_ManagedTypeNames = __esmMin((() => {
|
|
2083
|
+
init_ManagedDecodeBudget();
|
|
2084
|
+
init_ManagedMemberInspectorCore();
|
|
2085
|
+
init_ManagedMetadataLayout();
|
|
2086
|
+
init_ManagedMetadataHeaps();
|
|
2087
|
+
init_ManagedReaderFailure();
|
|
2088
|
+
typeNameLookup = (bytes, layout, ranges, issues) => {
|
|
2089
|
+
const names = new Map();
|
|
2090
|
+
const checkedScopes = new Set();
|
|
2091
|
+
const validateScopeChain = (row) => {
|
|
2092
|
+
const path = new Set();
|
|
2093
|
+
let current = row;
|
|
2094
|
+
while (!checkedScopes.has(current)) {
|
|
2095
|
+
const cursor = metadataRowCursor(bytes, layout, 1, current);
|
|
2096
|
+
if (path.has(current)) {
|
|
2097
|
+
issues.push({
|
|
2098
|
+
code: "invalid-row",
|
|
2099
|
+
scope: `metadata.TypeRef:${metadataToken(1, current)}`,
|
|
2100
|
+
offset: cursor.start,
|
|
2101
|
+
detail: "TypeRef ResolutionScope chain contains a cycle"
|
|
2102
|
+
});
|
|
2103
|
+
break;
|
|
2104
|
+
}
|
|
2105
|
+
managedDecodeBudget(layout).reserve(128, cursor.start);
|
|
2106
|
+
path.add(current);
|
|
2107
|
+
const raw = cursor.readIndex(layout.codedIndexSize("ResolutionScope"));
|
|
2108
|
+
const reason = metadataCodedTokenInvalidReason(raw, 2, [
|
|
2109
|
+
0,
|
|
2110
|
+
26,
|
|
2111
|
+
35,
|
|
2112
|
+
1
|
|
2113
|
+
], layout.rowCounts);
|
|
2114
|
+
if (reason !== null) {
|
|
2115
|
+
issues.push({
|
|
2116
|
+
code: "invalid-row",
|
|
2117
|
+
scope: `metadata.TypeRef:${metadataToken(1, current)}`,
|
|
2118
|
+
offset: cursor.start,
|
|
2119
|
+
detail: `TypeRef ResolutionScope coded index 0x${raw.toString(16)} is invalid: ${reason}`
|
|
2120
|
+
});
|
|
2121
|
+
break;
|
|
2122
|
+
}
|
|
2123
|
+
if (raw === 0 || (raw & 3) !== 3) break;
|
|
2124
|
+
current = Math.floor(raw / 4);
|
|
2125
|
+
}
|
|
2126
|
+
for (const visited of path) checkedScopes.add(visited);
|
|
2127
|
+
};
|
|
2128
|
+
const definitionName = (table, row) => {
|
|
2129
|
+
if (table === 2) {
|
|
2130
|
+
metadataRowOffset(layout, 2, row);
|
|
2131
|
+
return ranges[row - 1]?.fullName ?? null;
|
|
2132
|
+
}
|
|
2133
|
+
const cursor = metadataRowCursor(bytes, layout, 1, row);
|
|
2134
|
+
cursor.readIndex(layout.codedIndexSize("ResolutionScope"));
|
|
2135
|
+
readManagedValue(() => validateScopeChain(row), issues);
|
|
2136
|
+
const name = cursor.readIndex(layout.stringIndexSize);
|
|
2137
|
+
const namespace = cursor.readIndex(layout.stringIndexSize);
|
|
2138
|
+
return fullName(readMetadataString(bytes, layout, namespace, layout.strings.size), readMetadataString(bytes, layout, name, layout.strings.size));
|
|
2139
|
+
};
|
|
2140
|
+
const specName = (row) => {
|
|
2141
|
+
const cursor = metadataRowCursor(bytes, layout, 27, row);
|
|
2142
|
+
const spec = readMetadataBlob(bytes, layout, cursor.readIndex(layout.blobIndexSize), layout.blob.size);
|
|
2143
|
+
const owner = {
|
|
2144
|
+
form: "type",
|
|
2145
|
+
scope: `metadata.TypeSpec:${metadataToken(27, row)}`,
|
|
2146
|
+
offset: cursor.start
|
|
2147
|
+
};
|
|
2148
|
+
specSignature(layout, spec, owner);
|
|
2149
|
+
if (spec[0] !== 21) return null;
|
|
2150
|
+
const encoded = readCompressed(spec, 2).value;
|
|
2151
|
+
const table = [2, 1][encoded & 3];
|
|
2152
|
+
if (table === undefined) throw managedFailure("invalid-blob", owner.scope, "Generic instantiation does not name a TypeDef or TypeRef", owner.offset);
|
|
2153
|
+
return definitionName(table, Math.floor(encoded / 4));
|
|
2154
|
+
};
|
|
2155
|
+
return (token) => {
|
|
2156
|
+
if (token === null) return null;
|
|
2157
|
+
if (names.has(token)) return names.get(token) ?? null;
|
|
2158
|
+
const table = Number.parseInt(token.slice(2, 4), 16);
|
|
2159
|
+
const row = Number.parseInt(token.slice(4), 16);
|
|
2160
|
+
const name = readManagedValue(() => table === 27 ? specName(row) : table === 1 || table === 2 ? definitionName(table, row) : null, issues) ?? null;
|
|
2161
|
+
names.set(token, name);
|
|
2162
|
+
return name;
|
|
2163
|
+
};
|
|
2164
|
+
};
|
|
2165
|
+
})))();
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
//#endregion
|
|
2169
|
+
//#region dist/dotnet/ManagedUserStrings.js
|
|
2170
|
+
var inventory, USER_STRING_TOKEN_BYTES, parseUserStrings;
|
|
2171
|
+
function init_ManagedUserStrings() {
|
|
2172
|
+
return (init_ManagedUserStrings = __esmMin((() => {
|
|
2173
|
+
init_ManagedDecodeBudget();
|
|
2174
|
+
init_ManagedMetadataHeaps();
|
|
2175
|
+
init_ManagedReaderFailure();
|
|
2176
|
+
inventory = (literals, issues, scanned) => ({
|
|
2177
|
+
state: issues.length === 0 && scanned ? "complete" : "partial",
|
|
2178
|
+
literals,
|
|
2179
|
+
issues
|
|
2180
|
+
});
|
|
2181
|
+
USER_STRING_TOKEN_BYTES = 128;
|
|
2182
|
+
parseUserStrings = (bytes, layout, parsed) => {
|
|
2183
|
+
const { methods } = parsed;
|
|
2184
|
+
const budget = managedDecodeBudget(layout);
|
|
2185
|
+
const scanned = parsed.unscannedMethods === 0 && (parsed.unreadableSelectedTypes ?? 0) === 0;
|
|
2186
|
+
const userStrings = [];
|
|
2187
|
+
const issues = [];
|
|
2188
|
+
const tokens = new Set();
|
|
2189
|
+
try {
|
|
2190
|
+
for (const method of methods) for (const { opcode, operand } of method.body.anchors) if (opcode === "ldstr" && operand !== null && !tokens.has(operand)) {
|
|
2191
|
+
budget.admitTransient(USER_STRING_TOKEN_BYTES, null);
|
|
2192
|
+
tokens.add(operand);
|
|
2193
|
+
}
|
|
2194
|
+
const references = [];
|
|
2195
|
+
for (const token of [...tokens].sort()) {
|
|
2196
|
+
if (token.startsWith("0x70")) references.push(token);
|
|
2197
|
+
else issues.push(admitManagedProjection({
|
|
2198
|
+
code: "invalid-heap-index",
|
|
2199
|
+
scope: `metadata.#US:${token}`,
|
|
2200
|
+
offset: null,
|
|
2201
|
+
detail: "ldstr operand does not name an item inside #US"
|
|
2202
|
+
}, budget));
|
|
2203
|
+
}
|
|
2204
|
+
if (references.length > 0 && layout.userStrings === null) {
|
|
2205
|
+
issues.push(admitManagedProjection({
|
|
2206
|
+
code: "missing-stream",
|
|
2207
|
+
scope: "metadata.#US",
|
|
2208
|
+
offset: null,
|
|
2209
|
+
detail: `${String(references.length)} distinct ldstr operand(s) reference #US, but the metadata has no #US stream`
|
|
2210
|
+
}, budget));
|
|
2211
|
+
return inventory(userStrings, issues, scanned);
|
|
2212
|
+
}
|
|
2213
|
+
for (const token of references) {
|
|
2214
|
+
const failures = [];
|
|
2215
|
+
readManagedValue(() => {
|
|
2216
|
+
const { offset, value, issues: observed } = readMetadataUserString(bytes, layout, token);
|
|
2217
|
+
for (const issue of observed) failures.push(issue);
|
|
2218
|
+
userStrings.push(admitManagedProjection({
|
|
2219
|
+
token,
|
|
2220
|
+
offset,
|
|
2221
|
+
value
|
|
2222
|
+
}, budget));
|
|
2223
|
+
}, failures);
|
|
2224
|
+
for (const failure of failures) issues.push(admitManagedProjection(failure, budget));
|
|
2225
|
+
}
|
|
2226
|
+
return inventory(userStrings, issues, scanned);
|
|
2227
|
+
} finally {
|
|
2228
|
+
budget.releaseTransient();
|
|
2229
|
+
}
|
|
2230
|
+
};
|
|
2231
|
+
})))();
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
//#endregion
|
|
2235
|
+
//#region dist/dotnet/ManagedTypeMemberLists.js
|
|
2236
|
+
var readTypeMemberListFacts;
|
|
2237
|
+
function init_ManagedTypeMemberLists() {
|
|
2238
|
+
return (init_ManagedTypeMemberLists = __esmMin((() => {
|
|
2239
|
+
init_ManagedDecodeBudget();
|
|
2240
|
+
init_ManagedMetadataHeaps();
|
|
2241
|
+
init_ManagedMemberPointers();
|
|
2242
|
+
readTypeMemberListFacts = (bytes, layout) => {
|
|
2243
|
+
const fields = memberListTable(layout, 4);
|
|
2244
|
+
const methods = memberListTable(layout, 6);
|
|
2245
|
+
const rows = [];
|
|
2246
|
+
const issues = [];
|
|
2247
|
+
const types = layout.table(2);
|
|
2248
|
+
const typeCount = types?.rowCount ?? 0;
|
|
2249
|
+
managedDecodeBudget(layout).reserve(typeCount * 512 + 256, types?.offset ?? null);
|
|
2250
|
+
for (let row = 1; row <= typeCount; row += 1) {
|
|
2251
|
+
const cursor = metadataRowCursor(bytes, layout, 2, row);
|
|
2252
|
+
cursor.readUInt32();
|
|
2253
|
+
cursor.readIndex(layout.stringIndexSize);
|
|
2254
|
+
cursor.readIndex(layout.stringIndexSize);
|
|
2255
|
+
cursor.readIndex(layout.codedIndexSize("TypeDefOrRef"));
|
|
2256
|
+
const field = {
|
|
2257
|
+
offset: cursor.offset,
|
|
2258
|
+
raw: cursor.readIndex(memberListIndexSize(layout, 4))
|
|
2259
|
+
};
|
|
2260
|
+
const method = {
|
|
2261
|
+
offset: cursor.offset,
|
|
2262
|
+
raw: cursor.readIndex(memberListIndexSize(layout, 6))
|
|
2263
|
+
};
|
|
2264
|
+
const entry = {
|
|
2265
|
+
field: {
|
|
2266
|
+
...field,
|
|
2267
|
+
value: validatedMemberListStart(field.raw, fields)
|
|
2268
|
+
},
|
|
2269
|
+
method: {
|
|
2270
|
+
...method,
|
|
2271
|
+
value: validatedMemberListStart(method.raw, methods)
|
|
2272
|
+
}
|
|
2273
|
+
};
|
|
2274
|
+
rows.push(entry);
|
|
2275
|
+
for (const [name, start, table] of [[
|
|
2276
|
+
"FieldList",
|
|
2277
|
+
entry.field,
|
|
2278
|
+
fields
|
|
2279
|
+
], [
|
|
2280
|
+
"MethodList",
|
|
2281
|
+
entry.method,
|
|
2282
|
+
methods
|
|
2283
|
+
]]) if (start.value === null) {
|
|
2284
|
+
managedDecodeBudget(layout).reserve(512, start.offset);
|
|
2285
|
+
issues.push({
|
|
2286
|
+
code: "invalid-row",
|
|
2287
|
+
scope: `metadata.TypeDef:${metadataToken(2, row)}`,
|
|
2288
|
+
offset: start.offset,
|
|
2289
|
+
detail: `TypeDef ${name} start ${String(start.raw)} is outside the one-based list range 1..${String((table?.rowCount ?? 0) + 1)}`
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
const nonmonotonicFields = new Set();
|
|
2294
|
+
const nonmonotonicMethods = new Set();
|
|
2295
|
+
for (let index = 0; index + 1 < rows.length; index += 1) {
|
|
2296
|
+
const current = rows[index];
|
|
2297
|
+
const next = rows[index + 1];
|
|
2298
|
+
if (current === undefined || next === undefined) continue;
|
|
2299
|
+
for (const [name, before, after, affected] of [[
|
|
2300
|
+
"FieldList",
|
|
2301
|
+
current.field,
|
|
2302
|
+
next.field,
|
|
2303
|
+
nonmonotonicFields
|
|
2304
|
+
], [
|
|
2305
|
+
"MethodList",
|
|
2306
|
+
current.method,
|
|
2307
|
+
next.method,
|
|
2308
|
+
nonmonotonicMethods
|
|
2309
|
+
]]) if (before.value !== null && after.value !== null && after.value < before.value) {
|
|
2310
|
+
managedDecodeBudget(layout).reserve(512, after.offset);
|
|
2311
|
+
affected.add(index);
|
|
2312
|
+
affected.add(index + 1);
|
|
2313
|
+
issues.push({
|
|
2314
|
+
code: "invalid-row",
|
|
2315
|
+
scope: `metadata.TypeDef:${metadataToken(2, index + 2)}`,
|
|
2316
|
+
offset: after.offset,
|
|
2317
|
+
detail: `TypeDef ${name} start ${String(after.raw)} decreases from preceding start ${String(before.raw)}; adjacent member ranges are unknown`
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
const entries = rows.map((entry, index) => {
|
|
2322
|
+
const next = rows[index + 1];
|
|
2323
|
+
return {
|
|
2324
|
+
field: {
|
|
2325
|
+
start: {
|
|
2326
|
+
...entry.field,
|
|
2327
|
+
value: nonmonotonicFields.has(index) ? null : entry.field.value
|
|
2328
|
+
},
|
|
2329
|
+
end: next === undefined ? (fields?.rowCount ?? 0) + 1 : nonmonotonicFields.has(index) || nonmonotonicFields.has(index + 1) ? null : next.field.value
|
|
2330
|
+
},
|
|
2331
|
+
method: {
|
|
2332
|
+
start: {
|
|
2333
|
+
...entry.method,
|
|
2334
|
+
value: nonmonotonicMethods.has(index) ? null : entry.method.value
|
|
2335
|
+
},
|
|
2336
|
+
end: next === undefined ? (methods?.rowCount ?? 0) + 1 : nonmonotonicMethods.has(index) || nonmonotonicMethods.has(index + 1) ? null : next.method.value
|
|
2337
|
+
}
|
|
2338
|
+
};
|
|
2339
|
+
});
|
|
2340
|
+
return {
|
|
2341
|
+
entries,
|
|
2342
|
+
issues
|
|
2343
|
+
};
|
|
2344
|
+
};
|
|
2345
|
+
})))();
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
//#endregion
|
|
2349
|
+
//#region dist/dotnet/ManagedMemberInstructionDecoder.js
|
|
2350
|
+
var PREFIX_OPCODES, OPCODES, tokenKind, floatingPointOperand, fixed, FIXED_OPERAND_READERS, TOKEN_OPERAND_KINDS, TOKEN_OPERAND_WIDTH, operandExtent, readOperand, decodeInstructions, parseExceptionRegions, malformedExceptionRegions, readExceptionClauses;
|
|
2351
|
+
function init_ManagedMemberInstructionDecoder() {
|
|
2352
|
+
return (init_ManagedMemberInstructionDecoder = __esmMin((() => {
|
|
2353
|
+
init_ManagedReaderFailure();
|
|
2354
|
+
PREFIX_OPCODES = new Set([
|
|
2355
|
+
"unaligned.",
|
|
2356
|
+
"volatile.",
|
|
2357
|
+
"tail.",
|
|
2358
|
+
"constrained.",
|
|
2359
|
+
"readonly.",
|
|
2360
|
+
"no."
|
|
2361
|
+
]);
|
|
2362
|
+
OPCODES = new Map([
|
|
2363
|
+
[0, {
|
|
2364
|
+
name: "nop",
|
|
2365
|
+
operand: "none"
|
|
2366
|
+
}],
|
|
2367
|
+
[1, {
|
|
2368
|
+
name: "break",
|
|
2369
|
+
operand: "none"
|
|
2370
|
+
}],
|
|
2371
|
+
[2, {
|
|
2372
|
+
name: "ldarg.0",
|
|
2373
|
+
operand: "none"
|
|
2374
|
+
}],
|
|
2375
|
+
[3, {
|
|
2376
|
+
name: "ldarg.1",
|
|
2377
|
+
operand: "none"
|
|
2378
|
+
}],
|
|
2379
|
+
[4, {
|
|
2380
|
+
name: "ldarg.2",
|
|
2381
|
+
operand: "none"
|
|
2382
|
+
}],
|
|
2383
|
+
[5, {
|
|
2384
|
+
name: "ldarg.3",
|
|
2385
|
+
operand: "none"
|
|
2386
|
+
}],
|
|
2387
|
+
[6, {
|
|
2388
|
+
name: "ldloc.0",
|
|
2389
|
+
operand: "none"
|
|
2390
|
+
}],
|
|
2391
|
+
[7, {
|
|
2392
|
+
name: "ldloc.1",
|
|
2393
|
+
operand: "none"
|
|
2394
|
+
}],
|
|
2395
|
+
[8, {
|
|
2396
|
+
name: "ldloc.2",
|
|
2397
|
+
operand: "none"
|
|
2398
|
+
}],
|
|
2399
|
+
[9, {
|
|
2400
|
+
name: "ldloc.3",
|
|
2401
|
+
operand: "none"
|
|
2402
|
+
}],
|
|
2403
|
+
[10, {
|
|
2404
|
+
name: "stloc.0",
|
|
2405
|
+
operand: "none"
|
|
2406
|
+
}],
|
|
2407
|
+
[11, {
|
|
2408
|
+
name: "stloc.1",
|
|
2409
|
+
operand: "none"
|
|
2410
|
+
}],
|
|
2411
|
+
[12, {
|
|
2412
|
+
name: "stloc.2",
|
|
2413
|
+
operand: "none"
|
|
2414
|
+
}],
|
|
2415
|
+
[13, {
|
|
2416
|
+
name: "stloc.3",
|
|
2417
|
+
operand: "none"
|
|
2418
|
+
}],
|
|
2419
|
+
[14, {
|
|
2420
|
+
name: "ldarg.s",
|
|
2421
|
+
operand: "short-var"
|
|
2422
|
+
}],
|
|
2423
|
+
[15, {
|
|
2424
|
+
name: "ldarga.s",
|
|
2425
|
+
operand: "short-var"
|
|
2426
|
+
}],
|
|
2427
|
+
[16, {
|
|
2428
|
+
name: "starg.s",
|
|
2429
|
+
operand: "short-var"
|
|
2430
|
+
}],
|
|
2431
|
+
[17, {
|
|
2432
|
+
name: "ldloc.s",
|
|
2433
|
+
operand: "short-var"
|
|
2434
|
+
}],
|
|
2435
|
+
[18, {
|
|
2436
|
+
name: "ldloca.s",
|
|
2437
|
+
operand: "short-var"
|
|
2438
|
+
}],
|
|
2439
|
+
[19, {
|
|
2440
|
+
name: "stloc.s",
|
|
2441
|
+
operand: "short-var"
|
|
2442
|
+
}],
|
|
2443
|
+
[20, {
|
|
2444
|
+
name: "ldnull",
|
|
2445
|
+
operand: "none"
|
|
2446
|
+
}],
|
|
2447
|
+
[21, {
|
|
2448
|
+
name: "ldc.i4.m1",
|
|
2449
|
+
operand: "none"
|
|
2450
|
+
}],
|
|
2451
|
+
[22, {
|
|
2452
|
+
name: "ldc.i4.0",
|
|
2453
|
+
operand: "none"
|
|
2454
|
+
}],
|
|
2455
|
+
[23, {
|
|
2456
|
+
name: "ldc.i4.1",
|
|
2457
|
+
operand: "none"
|
|
2458
|
+
}],
|
|
2459
|
+
[24, {
|
|
2460
|
+
name: "ldc.i4.2",
|
|
2461
|
+
operand: "none"
|
|
2462
|
+
}],
|
|
2463
|
+
[25, {
|
|
2464
|
+
name: "ldc.i4.3",
|
|
2465
|
+
operand: "none"
|
|
2466
|
+
}],
|
|
2467
|
+
[26, {
|
|
2468
|
+
name: "ldc.i4.4",
|
|
2469
|
+
operand: "none"
|
|
2470
|
+
}],
|
|
2471
|
+
[27, {
|
|
2472
|
+
name: "ldc.i4.5",
|
|
2473
|
+
operand: "none"
|
|
2474
|
+
}],
|
|
2475
|
+
[28, {
|
|
2476
|
+
name: "ldc.i4.6",
|
|
2477
|
+
operand: "none"
|
|
2478
|
+
}],
|
|
2479
|
+
[29, {
|
|
2480
|
+
name: "ldc.i4.7",
|
|
2481
|
+
operand: "none"
|
|
2482
|
+
}],
|
|
2483
|
+
[30, {
|
|
2484
|
+
name: "ldc.i4.8",
|
|
2485
|
+
operand: "none"
|
|
2486
|
+
}],
|
|
2487
|
+
[31, {
|
|
2488
|
+
name: "ldc.i4.s",
|
|
2489
|
+
operand: "short-i"
|
|
2490
|
+
}],
|
|
2491
|
+
[32, {
|
|
2492
|
+
name: "ldc.i4",
|
|
2493
|
+
operand: "i"
|
|
2494
|
+
}],
|
|
2495
|
+
[33, {
|
|
2496
|
+
name: "ldc.i8",
|
|
2497
|
+
operand: "i8"
|
|
2498
|
+
}],
|
|
2499
|
+
[34, {
|
|
2500
|
+
name: "ldc.r4",
|
|
2501
|
+
operand: "r4"
|
|
2502
|
+
}],
|
|
2503
|
+
[35, {
|
|
2504
|
+
name: "ldc.r8",
|
|
2505
|
+
operand: "r8"
|
|
2506
|
+
}],
|
|
2507
|
+
[37, {
|
|
2508
|
+
name: "dup",
|
|
2509
|
+
operand: "none"
|
|
2510
|
+
}],
|
|
2511
|
+
[38, {
|
|
2512
|
+
name: "pop",
|
|
2513
|
+
operand: "none"
|
|
2514
|
+
}],
|
|
2515
|
+
[39, {
|
|
2516
|
+
name: "jmp",
|
|
2517
|
+
operand: "method"
|
|
2518
|
+
}],
|
|
2519
|
+
[40, {
|
|
2520
|
+
name: "call",
|
|
2521
|
+
operand: "method"
|
|
2522
|
+
}],
|
|
2523
|
+
[41, {
|
|
2524
|
+
name: "calli",
|
|
2525
|
+
operand: "signature"
|
|
2526
|
+
}],
|
|
2527
|
+
[42, {
|
|
2528
|
+
name: "ret",
|
|
2529
|
+
operand: "none"
|
|
2530
|
+
}],
|
|
2531
|
+
[43, {
|
|
2532
|
+
name: "br.s",
|
|
2533
|
+
operand: "short-branch"
|
|
2534
|
+
}],
|
|
2535
|
+
[44, {
|
|
2536
|
+
name: "brfalse.s",
|
|
2537
|
+
operand: "short-branch"
|
|
2538
|
+
}],
|
|
2539
|
+
[45, {
|
|
2540
|
+
name: "brtrue.s",
|
|
2541
|
+
operand: "short-branch"
|
|
2542
|
+
}],
|
|
2543
|
+
[46, {
|
|
2544
|
+
name: "beq.s",
|
|
2545
|
+
operand: "short-branch"
|
|
2546
|
+
}],
|
|
2547
|
+
[47, {
|
|
2548
|
+
name: "bge.s",
|
|
2549
|
+
operand: "short-branch"
|
|
2550
|
+
}],
|
|
2551
|
+
[48, {
|
|
2552
|
+
name: "bgt.s",
|
|
2553
|
+
operand: "short-branch"
|
|
2554
|
+
}],
|
|
2555
|
+
[49, {
|
|
2556
|
+
name: "ble.s",
|
|
2557
|
+
operand: "short-branch"
|
|
2558
|
+
}],
|
|
2559
|
+
[50, {
|
|
2560
|
+
name: "blt.s",
|
|
2561
|
+
operand: "short-branch"
|
|
2562
|
+
}],
|
|
2563
|
+
[51, {
|
|
2564
|
+
name: "bne.un.s",
|
|
2565
|
+
operand: "short-branch"
|
|
2566
|
+
}],
|
|
2567
|
+
[52, {
|
|
2568
|
+
name: "bge.un.s",
|
|
2569
|
+
operand: "short-branch"
|
|
2570
|
+
}],
|
|
2571
|
+
[53, {
|
|
2572
|
+
name: "bgt.un.s",
|
|
2573
|
+
operand: "short-branch"
|
|
2574
|
+
}],
|
|
2575
|
+
[54, {
|
|
2576
|
+
name: "ble.un.s",
|
|
2577
|
+
operand: "short-branch"
|
|
2578
|
+
}],
|
|
2579
|
+
[55, {
|
|
2580
|
+
name: "blt.un.s",
|
|
2581
|
+
operand: "short-branch"
|
|
2582
|
+
}],
|
|
2583
|
+
[56, {
|
|
2584
|
+
name: "br",
|
|
2585
|
+
operand: "branch"
|
|
2586
|
+
}],
|
|
2587
|
+
[57, {
|
|
2588
|
+
name: "brfalse",
|
|
2589
|
+
operand: "branch"
|
|
2590
|
+
}],
|
|
2591
|
+
[58, {
|
|
2592
|
+
name: "brtrue",
|
|
2593
|
+
operand: "branch"
|
|
2594
|
+
}],
|
|
2595
|
+
[59, {
|
|
2596
|
+
name: "beq",
|
|
2597
|
+
operand: "branch"
|
|
2598
|
+
}],
|
|
2599
|
+
[60, {
|
|
2600
|
+
name: "bge",
|
|
2601
|
+
operand: "branch"
|
|
2602
|
+
}],
|
|
2603
|
+
[61, {
|
|
2604
|
+
name: "bgt",
|
|
2605
|
+
operand: "branch"
|
|
2606
|
+
}],
|
|
2607
|
+
[62, {
|
|
2608
|
+
name: "ble",
|
|
2609
|
+
operand: "branch"
|
|
2610
|
+
}],
|
|
2611
|
+
[63, {
|
|
2612
|
+
name: "blt",
|
|
2613
|
+
operand: "branch"
|
|
2614
|
+
}],
|
|
2615
|
+
[64, {
|
|
2616
|
+
name: "bne.un",
|
|
2617
|
+
operand: "branch"
|
|
2618
|
+
}],
|
|
2619
|
+
[65, {
|
|
2620
|
+
name: "bge.un",
|
|
2621
|
+
operand: "branch"
|
|
2622
|
+
}],
|
|
2623
|
+
[66, {
|
|
2624
|
+
name: "bgt.un",
|
|
2625
|
+
operand: "branch"
|
|
2626
|
+
}],
|
|
2627
|
+
[67, {
|
|
2628
|
+
name: "ble.un",
|
|
2629
|
+
operand: "branch"
|
|
2630
|
+
}],
|
|
2631
|
+
[68, {
|
|
2632
|
+
name: "blt.un",
|
|
2633
|
+
operand: "branch"
|
|
2634
|
+
}],
|
|
2635
|
+
[69, {
|
|
2636
|
+
name: "switch",
|
|
2637
|
+
operand: "switch"
|
|
2638
|
+
}],
|
|
2639
|
+
[70, {
|
|
2640
|
+
name: "ldind.i1",
|
|
2641
|
+
operand: "none"
|
|
2642
|
+
}],
|
|
2643
|
+
[71, {
|
|
2644
|
+
name: "ldind.u1",
|
|
2645
|
+
operand: "none"
|
|
2646
|
+
}],
|
|
2647
|
+
[72, {
|
|
2648
|
+
name: "ldind.i2",
|
|
2649
|
+
operand: "none"
|
|
2650
|
+
}],
|
|
2651
|
+
[73, {
|
|
2652
|
+
name: "ldind.u2",
|
|
2653
|
+
operand: "none"
|
|
2654
|
+
}],
|
|
2655
|
+
[74, {
|
|
2656
|
+
name: "ldind.i4",
|
|
2657
|
+
operand: "none"
|
|
2658
|
+
}],
|
|
2659
|
+
[75, {
|
|
2660
|
+
name: "ldind.u4",
|
|
2661
|
+
operand: "none"
|
|
2662
|
+
}],
|
|
2663
|
+
[76, {
|
|
2664
|
+
name: "ldind.i8",
|
|
2665
|
+
operand: "none"
|
|
2666
|
+
}],
|
|
2667
|
+
[77, {
|
|
2668
|
+
name: "ldind.i",
|
|
2669
|
+
operand: "none"
|
|
2670
|
+
}],
|
|
2671
|
+
[78, {
|
|
2672
|
+
name: "ldind.r4",
|
|
2673
|
+
operand: "none"
|
|
2674
|
+
}],
|
|
2675
|
+
[79, {
|
|
2676
|
+
name: "ldind.r8",
|
|
2677
|
+
operand: "none"
|
|
2678
|
+
}],
|
|
2679
|
+
[80, {
|
|
2680
|
+
name: "ldind.ref",
|
|
2681
|
+
operand: "none"
|
|
2682
|
+
}],
|
|
2683
|
+
[81, {
|
|
2684
|
+
name: "stind.ref",
|
|
2685
|
+
operand: "none"
|
|
2686
|
+
}],
|
|
2687
|
+
[82, {
|
|
2688
|
+
name: "stind.i1",
|
|
2689
|
+
operand: "none"
|
|
2690
|
+
}],
|
|
2691
|
+
[83, {
|
|
2692
|
+
name: "stind.i2",
|
|
2693
|
+
operand: "none"
|
|
2694
|
+
}],
|
|
2695
|
+
[84, {
|
|
2696
|
+
name: "stind.i4",
|
|
2697
|
+
operand: "none"
|
|
2698
|
+
}],
|
|
2699
|
+
[85, {
|
|
2700
|
+
name: "stind.i8",
|
|
2701
|
+
operand: "none"
|
|
2702
|
+
}],
|
|
2703
|
+
[86, {
|
|
2704
|
+
name: "stind.r4",
|
|
2705
|
+
operand: "none"
|
|
2706
|
+
}],
|
|
2707
|
+
[87, {
|
|
2708
|
+
name: "stind.r8",
|
|
2709
|
+
operand: "none"
|
|
2710
|
+
}],
|
|
2711
|
+
[88, {
|
|
2712
|
+
name: "add",
|
|
2713
|
+
operand: "none"
|
|
2714
|
+
}],
|
|
2715
|
+
[89, {
|
|
2716
|
+
name: "sub",
|
|
2717
|
+
operand: "none"
|
|
2718
|
+
}],
|
|
2719
|
+
[90, {
|
|
2720
|
+
name: "mul",
|
|
2721
|
+
operand: "none"
|
|
2722
|
+
}],
|
|
2723
|
+
[91, {
|
|
2724
|
+
name: "div",
|
|
2725
|
+
operand: "none"
|
|
2726
|
+
}],
|
|
2727
|
+
[92, {
|
|
2728
|
+
name: "div.un",
|
|
2729
|
+
operand: "none"
|
|
2730
|
+
}],
|
|
2731
|
+
[93, {
|
|
2732
|
+
name: "rem",
|
|
2733
|
+
operand: "none"
|
|
2734
|
+
}],
|
|
2735
|
+
[94, {
|
|
2736
|
+
name: "rem.un",
|
|
2737
|
+
operand: "none"
|
|
2738
|
+
}],
|
|
2739
|
+
[95, {
|
|
2740
|
+
name: "and",
|
|
2741
|
+
operand: "none"
|
|
2742
|
+
}],
|
|
2743
|
+
[96, {
|
|
2744
|
+
name: "or",
|
|
2745
|
+
operand: "none"
|
|
2746
|
+
}],
|
|
2747
|
+
[97, {
|
|
2748
|
+
name: "xor",
|
|
2749
|
+
operand: "none"
|
|
2750
|
+
}],
|
|
2751
|
+
[98, {
|
|
2752
|
+
name: "shl",
|
|
2753
|
+
operand: "none"
|
|
2754
|
+
}],
|
|
2755
|
+
[99, {
|
|
2756
|
+
name: "shr",
|
|
2757
|
+
operand: "none"
|
|
2758
|
+
}],
|
|
2759
|
+
[100, {
|
|
2760
|
+
name: "shr.un",
|
|
2761
|
+
operand: "none"
|
|
2762
|
+
}],
|
|
2763
|
+
[101, {
|
|
2764
|
+
name: "neg",
|
|
2765
|
+
operand: "none"
|
|
2766
|
+
}],
|
|
2767
|
+
[102, {
|
|
2768
|
+
name: "not",
|
|
2769
|
+
operand: "none"
|
|
2770
|
+
}],
|
|
2771
|
+
[103, {
|
|
2772
|
+
name: "conv.i1",
|
|
2773
|
+
operand: "none"
|
|
2774
|
+
}],
|
|
2775
|
+
[104, {
|
|
2776
|
+
name: "conv.i2",
|
|
2777
|
+
operand: "none"
|
|
2778
|
+
}],
|
|
2779
|
+
[105, {
|
|
2780
|
+
name: "conv.i4",
|
|
2781
|
+
operand: "none"
|
|
2782
|
+
}],
|
|
2783
|
+
[106, {
|
|
2784
|
+
name: "conv.i8",
|
|
2785
|
+
operand: "none"
|
|
2786
|
+
}],
|
|
2787
|
+
[107, {
|
|
2788
|
+
name: "conv.r4",
|
|
2789
|
+
operand: "none"
|
|
2790
|
+
}],
|
|
2791
|
+
[108, {
|
|
2792
|
+
name: "conv.r8",
|
|
2793
|
+
operand: "none"
|
|
2794
|
+
}],
|
|
2795
|
+
[109, {
|
|
2796
|
+
name: "conv.u4",
|
|
2797
|
+
operand: "none"
|
|
2798
|
+
}],
|
|
2799
|
+
[110, {
|
|
2800
|
+
name: "conv.u8",
|
|
2801
|
+
operand: "none"
|
|
2802
|
+
}],
|
|
2803
|
+
[111, {
|
|
2804
|
+
name: "callvirt",
|
|
2805
|
+
operand: "method"
|
|
2806
|
+
}],
|
|
2807
|
+
[112, {
|
|
2808
|
+
name: "cpobj",
|
|
2809
|
+
operand: "type"
|
|
2810
|
+
}],
|
|
2811
|
+
[113, {
|
|
2812
|
+
name: "ldobj",
|
|
2813
|
+
operand: "type"
|
|
2814
|
+
}],
|
|
2815
|
+
[114, {
|
|
2816
|
+
name: "ldstr",
|
|
2817
|
+
operand: "string"
|
|
2818
|
+
}],
|
|
2819
|
+
[115, {
|
|
2820
|
+
name: "newobj",
|
|
2821
|
+
operand: "method"
|
|
2822
|
+
}],
|
|
2823
|
+
[116, {
|
|
2824
|
+
name: "castclass",
|
|
2825
|
+
operand: "type"
|
|
2826
|
+
}],
|
|
2827
|
+
[117, {
|
|
2828
|
+
name: "isinst",
|
|
2829
|
+
operand: "type"
|
|
2830
|
+
}],
|
|
2831
|
+
[118, {
|
|
2832
|
+
name: "conv.r.un",
|
|
2833
|
+
operand: "none"
|
|
2834
|
+
}],
|
|
2835
|
+
[121, {
|
|
2836
|
+
name: "unbox",
|
|
2837
|
+
operand: "type"
|
|
2838
|
+
}],
|
|
2839
|
+
[122, {
|
|
2840
|
+
name: "throw",
|
|
2841
|
+
operand: "none"
|
|
2842
|
+
}],
|
|
2843
|
+
[123, {
|
|
2844
|
+
name: "ldfld",
|
|
2845
|
+
operand: "field"
|
|
2846
|
+
}],
|
|
2847
|
+
[124, {
|
|
2848
|
+
name: "ldflda",
|
|
2849
|
+
operand: "field"
|
|
2850
|
+
}],
|
|
2851
|
+
[125, {
|
|
2852
|
+
name: "stfld",
|
|
2853
|
+
operand: "field"
|
|
2854
|
+
}],
|
|
2855
|
+
[126, {
|
|
2856
|
+
name: "ldsfld",
|
|
2857
|
+
operand: "field"
|
|
2858
|
+
}],
|
|
2859
|
+
[127, {
|
|
2860
|
+
name: "ldsflda",
|
|
2861
|
+
operand: "field"
|
|
2862
|
+
}],
|
|
2863
|
+
[128, {
|
|
2864
|
+
name: "stsfld",
|
|
2865
|
+
operand: "field"
|
|
2866
|
+
}],
|
|
2867
|
+
[129, {
|
|
2868
|
+
name: "stobj",
|
|
2869
|
+
operand: "type"
|
|
2870
|
+
}],
|
|
2871
|
+
[130, {
|
|
2872
|
+
name: "conv.ovf.i1.un",
|
|
2873
|
+
operand: "none"
|
|
2874
|
+
}],
|
|
2875
|
+
[131, {
|
|
2876
|
+
name: "conv.ovf.i2.un",
|
|
2877
|
+
operand: "none"
|
|
2878
|
+
}],
|
|
2879
|
+
[132, {
|
|
2880
|
+
name: "conv.ovf.i4.un",
|
|
2881
|
+
operand: "none"
|
|
2882
|
+
}],
|
|
2883
|
+
[133, {
|
|
2884
|
+
name: "conv.ovf.i8.un",
|
|
2885
|
+
operand: "none"
|
|
2886
|
+
}],
|
|
2887
|
+
[134, {
|
|
2888
|
+
name: "conv.ovf.u1.un",
|
|
2889
|
+
operand: "none"
|
|
2890
|
+
}],
|
|
2891
|
+
[135, {
|
|
2892
|
+
name: "conv.ovf.u2.un",
|
|
2893
|
+
operand: "none"
|
|
2894
|
+
}],
|
|
2895
|
+
[136, {
|
|
2896
|
+
name: "conv.ovf.u4.un",
|
|
2897
|
+
operand: "none"
|
|
2898
|
+
}],
|
|
2899
|
+
[137, {
|
|
2900
|
+
name: "conv.ovf.u8.un",
|
|
2901
|
+
operand: "none"
|
|
2902
|
+
}],
|
|
2903
|
+
[138, {
|
|
2904
|
+
name: "conv.ovf.i.un",
|
|
2905
|
+
operand: "none"
|
|
2906
|
+
}],
|
|
2907
|
+
[139, {
|
|
2908
|
+
name: "conv.ovf.u.un",
|
|
2909
|
+
operand: "none"
|
|
2910
|
+
}],
|
|
2911
|
+
[140, {
|
|
2912
|
+
name: "box",
|
|
2913
|
+
operand: "type"
|
|
2914
|
+
}],
|
|
2915
|
+
[141, {
|
|
2916
|
+
name: "newarr",
|
|
2917
|
+
operand: "type"
|
|
2918
|
+
}],
|
|
2919
|
+
[142, {
|
|
2920
|
+
name: "ldlen",
|
|
2921
|
+
operand: "none"
|
|
2922
|
+
}],
|
|
2923
|
+
[143, {
|
|
2924
|
+
name: "ldelema",
|
|
2925
|
+
operand: "type"
|
|
2926
|
+
}],
|
|
2927
|
+
[144, {
|
|
2928
|
+
name: "ldelem.i1",
|
|
2929
|
+
operand: "none"
|
|
2930
|
+
}],
|
|
2931
|
+
[145, {
|
|
2932
|
+
name: "ldelem.u1",
|
|
2933
|
+
operand: "none"
|
|
2934
|
+
}],
|
|
2935
|
+
[146, {
|
|
2936
|
+
name: "ldelem.i2",
|
|
2937
|
+
operand: "none"
|
|
2938
|
+
}],
|
|
2939
|
+
[147, {
|
|
2940
|
+
name: "ldelem.u2",
|
|
2941
|
+
operand: "none"
|
|
2942
|
+
}],
|
|
2943
|
+
[148, {
|
|
2944
|
+
name: "ldelem.i4",
|
|
2945
|
+
operand: "none"
|
|
2946
|
+
}],
|
|
2947
|
+
[149, {
|
|
2948
|
+
name: "ldelem.u4",
|
|
2949
|
+
operand: "none"
|
|
2950
|
+
}],
|
|
2951
|
+
[150, {
|
|
2952
|
+
name: "ldelem.i8",
|
|
2953
|
+
operand: "none"
|
|
2954
|
+
}],
|
|
2955
|
+
[151, {
|
|
2956
|
+
name: "ldelem.i",
|
|
2957
|
+
operand: "none"
|
|
2958
|
+
}],
|
|
2959
|
+
[152, {
|
|
2960
|
+
name: "ldelem.r4",
|
|
2961
|
+
operand: "none"
|
|
2962
|
+
}],
|
|
2963
|
+
[153, {
|
|
2964
|
+
name: "ldelem.r8",
|
|
2965
|
+
operand: "none"
|
|
2966
|
+
}],
|
|
2967
|
+
[154, {
|
|
2968
|
+
name: "ldelem.ref",
|
|
2969
|
+
operand: "none"
|
|
2970
|
+
}],
|
|
2971
|
+
[155, {
|
|
2972
|
+
name: "stelem.i",
|
|
2973
|
+
operand: "none"
|
|
2974
|
+
}],
|
|
2975
|
+
[156, {
|
|
2976
|
+
name: "stelem.i1",
|
|
2977
|
+
operand: "none"
|
|
2978
|
+
}],
|
|
2979
|
+
[157, {
|
|
2980
|
+
name: "stelem.i2",
|
|
2981
|
+
operand: "none"
|
|
2982
|
+
}],
|
|
2983
|
+
[158, {
|
|
2984
|
+
name: "stelem.i4",
|
|
2985
|
+
operand: "none"
|
|
2986
|
+
}],
|
|
2987
|
+
[159, {
|
|
2988
|
+
name: "stelem.i8",
|
|
2989
|
+
operand: "none"
|
|
2990
|
+
}],
|
|
2991
|
+
[160, {
|
|
2992
|
+
name: "stelem.r4",
|
|
2993
|
+
operand: "none"
|
|
2994
|
+
}],
|
|
2995
|
+
[161, {
|
|
2996
|
+
name: "stelem.r8",
|
|
2997
|
+
operand: "none"
|
|
2998
|
+
}],
|
|
2999
|
+
[162, {
|
|
3000
|
+
name: "stelem.ref",
|
|
3001
|
+
operand: "none"
|
|
3002
|
+
}],
|
|
3003
|
+
[163, {
|
|
3004
|
+
name: "ldelem",
|
|
3005
|
+
operand: "type"
|
|
3006
|
+
}],
|
|
3007
|
+
[164, {
|
|
3008
|
+
name: "stelem",
|
|
3009
|
+
operand: "type"
|
|
3010
|
+
}],
|
|
3011
|
+
[165, {
|
|
3012
|
+
name: "unbox.any",
|
|
3013
|
+
operand: "type"
|
|
3014
|
+
}],
|
|
3015
|
+
[179, {
|
|
3016
|
+
name: "conv.ovf.i1",
|
|
3017
|
+
operand: "none"
|
|
3018
|
+
}],
|
|
3019
|
+
[180, {
|
|
3020
|
+
name: "conv.ovf.u1",
|
|
3021
|
+
operand: "none"
|
|
3022
|
+
}],
|
|
3023
|
+
[181, {
|
|
3024
|
+
name: "conv.ovf.i2",
|
|
3025
|
+
operand: "none"
|
|
3026
|
+
}],
|
|
3027
|
+
[182, {
|
|
3028
|
+
name: "conv.ovf.u2",
|
|
3029
|
+
operand: "none"
|
|
3030
|
+
}],
|
|
3031
|
+
[183, {
|
|
3032
|
+
name: "conv.ovf.i4",
|
|
3033
|
+
operand: "none"
|
|
3034
|
+
}],
|
|
3035
|
+
[184, {
|
|
3036
|
+
name: "conv.ovf.u4",
|
|
3037
|
+
operand: "none"
|
|
3038
|
+
}],
|
|
3039
|
+
[185, {
|
|
3040
|
+
name: "conv.ovf.i8",
|
|
3041
|
+
operand: "none"
|
|
3042
|
+
}],
|
|
3043
|
+
[186, {
|
|
3044
|
+
name: "conv.ovf.u8",
|
|
3045
|
+
operand: "none"
|
|
3046
|
+
}],
|
|
3047
|
+
[194, {
|
|
3048
|
+
name: "refanyval",
|
|
3049
|
+
operand: "type"
|
|
3050
|
+
}],
|
|
3051
|
+
[195, {
|
|
3052
|
+
name: "ckfinite",
|
|
3053
|
+
operand: "none"
|
|
3054
|
+
}],
|
|
3055
|
+
[198, {
|
|
3056
|
+
name: "mkrefany",
|
|
3057
|
+
operand: "type"
|
|
3058
|
+
}],
|
|
3059
|
+
[208, {
|
|
3060
|
+
name: "ldtoken",
|
|
3061
|
+
operand: "token"
|
|
3062
|
+
}],
|
|
3063
|
+
[209, {
|
|
3064
|
+
name: "conv.u2",
|
|
3065
|
+
operand: "none"
|
|
3066
|
+
}],
|
|
3067
|
+
[210, {
|
|
3068
|
+
name: "conv.u1",
|
|
3069
|
+
operand: "none"
|
|
3070
|
+
}],
|
|
3071
|
+
[211, {
|
|
3072
|
+
name: "conv.i",
|
|
3073
|
+
operand: "none"
|
|
3074
|
+
}],
|
|
3075
|
+
[212, {
|
|
3076
|
+
name: "conv.ovf.i",
|
|
3077
|
+
operand: "none"
|
|
3078
|
+
}],
|
|
3079
|
+
[213, {
|
|
3080
|
+
name: "conv.ovf.u",
|
|
3081
|
+
operand: "none"
|
|
3082
|
+
}],
|
|
3083
|
+
[214, {
|
|
3084
|
+
name: "add.ovf",
|
|
3085
|
+
operand: "none"
|
|
3086
|
+
}],
|
|
3087
|
+
[215, {
|
|
3088
|
+
name: "add.ovf.un",
|
|
3089
|
+
operand: "none"
|
|
3090
|
+
}],
|
|
3091
|
+
[216, {
|
|
3092
|
+
name: "mul.ovf",
|
|
3093
|
+
operand: "none"
|
|
3094
|
+
}],
|
|
3095
|
+
[217, {
|
|
3096
|
+
name: "mul.ovf.un",
|
|
3097
|
+
operand: "none"
|
|
3098
|
+
}],
|
|
3099
|
+
[218, {
|
|
3100
|
+
name: "sub.ovf",
|
|
3101
|
+
operand: "none"
|
|
3102
|
+
}],
|
|
3103
|
+
[219, {
|
|
3104
|
+
name: "sub.ovf.un",
|
|
3105
|
+
operand: "none"
|
|
3106
|
+
}],
|
|
3107
|
+
[220, {
|
|
3108
|
+
name: "endfinally",
|
|
3109
|
+
operand: "none"
|
|
3110
|
+
}],
|
|
3111
|
+
[221, {
|
|
3112
|
+
name: "leave",
|
|
3113
|
+
operand: "branch"
|
|
3114
|
+
}],
|
|
3115
|
+
[222, {
|
|
3116
|
+
name: "leave.s",
|
|
3117
|
+
operand: "short-branch"
|
|
3118
|
+
}],
|
|
3119
|
+
[223, {
|
|
3120
|
+
name: "stind.i",
|
|
3121
|
+
operand: "none"
|
|
3122
|
+
}],
|
|
3123
|
+
[224, {
|
|
3124
|
+
name: "conv.u",
|
|
3125
|
+
operand: "none"
|
|
3126
|
+
}],
|
|
3127
|
+
[65024, {
|
|
3128
|
+
name: "arglist",
|
|
3129
|
+
operand: "none"
|
|
3130
|
+
}],
|
|
3131
|
+
[65025, {
|
|
3132
|
+
name: "ceq",
|
|
3133
|
+
operand: "none"
|
|
3134
|
+
}],
|
|
3135
|
+
[65026, {
|
|
3136
|
+
name: "cgt",
|
|
3137
|
+
operand: "none"
|
|
3138
|
+
}],
|
|
3139
|
+
[65027, {
|
|
3140
|
+
name: "cgt.un",
|
|
3141
|
+
operand: "none"
|
|
3142
|
+
}],
|
|
3143
|
+
[65028, {
|
|
3144
|
+
name: "clt",
|
|
3145
|
+
operand: "none"
|
|
3146
|
+
}],
|
|
3147
|
+
[65029, {
|
|
3148
|
+
name: "clt.un",
|
|
3149
|
+
operand: "none"
|
|
3150
|
+
}],
|
|
3151
|
+
[65030, {
|
|
3152
|
+
name: "ldftn",
|
|
3153
|
+
operand: "method"
|
|
3154
|
+
}],
|
|
3155
|
+
[65031, {
|
|
3156
|
+
name: "ldvirtftn",
|
|
3157
|
+
operand: "method"
|
|
3158
|
+
}],
|
|
3159
|
+
[65033, {
|
|
3160
|
+
name: "ldarg",
|
|
3161
|
+
operand: "var"
|
|
3162
|
+
}],
|
|
3163
|
+
[65034, {
|
|
3164
|
+
name: "ldarga",
|
|
3165
|
+
operand: "var"
|
|
3166
|
+
}],
|
|
3167
|
+
[65035, {
|
|
3168
|
+
name: "starg",
|
|
3169
|
+
operand: "var"
|
|
3170
|
+
}],
|
|
3171
|
+
[65036, {
|
|
3172
|
+
name: "ldloc",
|
|
3173
|
+
operand: "var"
|
|
3174
|
+
}],
|
|
3175
|
+
[65037, {
|
|
3176
|
+
name: "ldloca",
|
|
3177
|
+
operand: "var"
|
|
3178
|
+
}],
|
|
3179
|
+
[65038, {
|
|
3180
|
+
name: "stloc",
|
|
3181
|
+
operand: "var"
|
|
3182
|
+
}],
|
|
3183
|
+
[65039, {
|
|
3184
|
+
name: "localloc",
|
|
3185
|
+
operand: "none"
|
|
3186
|
+
}],
|
|
3187
|
+
[65041, {
|
|
3188
|
+
name: "endfilter",
|
|
3189
|
+
operand: "none"
|
|
3190
|
+
}],
|
|
3191
|
+
[65042, {
|
|
3192
|
+
name: "unaligned.",
|
|
3193
|
+
operand: "short-i"
|
|
3194
|
+
}],
|
|
3195
|
+
[65043, {
|
|
3196
|
+
name: "volatile.",
|
|
3197
|
+
operand: "none"
|
|
3198
|
+
}],
|
|
3199
|
+
[65044, {
|
|
3200
|
+
name: "tail.",
|
|
3201
|
+
operand: "none"
|
|
3202
|
+
}],
|
|
3203
|
+
[65045, {
|
|
3204
|
+
name: "initobj",
|
|
3205
|
+
operand: "type"
|
|
3206
|
+
}],
|
|
3207
|
+
[65046, {
|
|
3208
|
+
name: "constrained.",
|
|
3209
|
+
operand: "type"
|
|
3210
|
+
}],
|
|
3211
|
+
[65047, {
|
|
3212
|
+
name: "cpblk",
|
|
3213
|
+
operand: "none"
|
|
3214
|
+
}],
|
|
3215
|
+
[65048, {
|
|
3216
|
+
name: "initblk",
|
|
3217
|
+
operand: "none"
|
|
3218
|
+
}],
|
|
3219
|
+
[65049, {
|
|
3220
|
+
name: "no.",
|
|
3221
|
+
operand: "short-i"
|
|
3222
|
+
}],
|
|
3223
|
+
[65050, {
|
|
3224
|
+
name: "rethrow",
|
|
3225
|
+
operand: "none"
|
|
3226
|
+
}],
|
|
3227
|
+
[65052, {
|
|
3228
|
+
name: "sizeof",
|
|
3229
|
+
operand: "type"
|
|
3230
|
+
}],
|
|
3231
|
+
[65053, {
|
|
3232
|
+
name: "refanytype",
|
|
3233
|
+
operand: "none"
|
|
3234
|
+
}],
|
|
3235
|
+
[65054, {
|
|
3236
|
+
name: "readonly.",
|
|
3237
|
+
operand: "none"
|
|
3238
|
+
}]
|
|
3239
|
+
]);
|
|
3240
|
+
tokenKind = (token) => {
|
|
3241
|
+
if (token.startsWith("0x06") || token.startsWith("0x0a") || token.startsWith("0x2b")) return "method";
|
|
3242
|
+
if (token.startsWith("0x04")) return "field";
|
|
3243
|
+
if (token.startsWith("0x70")) return "string";
|
|
3244
|
+
if (token.startsWith("0x11")) return "signature";
|
|
3245
|
+
if (token.startsWith("0x01") || token.startsWith("0x02") || token.startsWith("0x1b")) return "type";
|
|
3246
|
+
return "token";
|
|
3247
|
+
};
|
|
3248
|
+
floatingPointOperand = (value) => Object.is(value, -0) ? "-0" : String(value);
|
|
3249
|
+
fixed = (width, read) => ({
|
|
3250
|
+
width,
|
|
3251
|
+
read
|
|
3252
|
+
});
|
|
3253
|
+
FIXED_OPERAND_READERS = new Map([
|
|
3254
|
+
["none", fixed(0, (_il, offset) => ({
|
|
3255
|
+
next: offset,
|
|
3256
|
+
anchorKind: "none",
|
|
3257
|
+
value: null
|
|
3258
|
+
}))],
|
|
3259
|
+
["short-var", fixed(1, (il, offset) => ({
|
|
3260
|
+
next: offset + 1,
|
|
3261
|
+
anchorKind: "variable",
|
|
3262
|
+
value: String(il.readUInt8(offset))
|
|
3263
|
+
}))],
|
|
3264
|
+
["var", fixed(2, (il, offset) => ({
|
|
3265
|
+
next: offset + 2,
|
|
3266
|
+
anchorKind: "variable",
|
|
3267
|
+
value: String(il.readUInt16LE(offset))
|
|
3268
|
+
}))],
|
|
3269
|
+
["short-i", fixed(1, (il, offset) => ({
|
|
3270
|
+
next: offset + 1,
|
|
3271
|
+
anchorKind: "constant",
|
|
3272
|
+
value: String(il.readInt8(offset))
|
|
3273
|
+
}))],
|
|
3274
|
+
["i", fixed(4, (il, offset) => ({
|
|
3275
|
+
next: offset + 4,
|
|
3276
|
+
anchorKind: "constant",
|
|
3277
|
+
value: String(il.readInt32LE(offset))
|
|
3278
|
+
}))],
|
|
3279
|
+
["i8", fixed(8, (il, offset) => ({
|
|
3280
|
+
next: offset + 8,
|
|
3281
|
+
anchorKind: "constant",
|
|
3282
|
+
value: il.readBigInt64LE(offset).toString()
|
|
3283
|
+
}))],
|
|
3284
|
+
["r4", fixed(4, (il, offset) => ({
|
|
3285
|
+
next: offset + 4,
|
|
3286
|
+
anchorKind: "constant",
|
|
3287
|
+
value: floatingPointOperand(il.readFloatLE(offset))
|
|
3288
|
+
}))],
|
|
3289
|
+
["r8", fixed(8, (il, offset) => ({
|
|
3290
|
+
next: offset + 8,
|
|
3291
|
+
anchorKind: "constant",
|
|
3292
|
+
value: floatingPointOperand(il.readDoubleLE(offset))
|
|
3293
|
+
}))],
|
|
3294
|
+
["short-branch", fixed(1, (il, offset) => ({
|
|
3295
|
+
next: offset + 1,
|
|
3296
|
+
anchorKind: "branch",
|
|
3297
|
+
value: String(offset + 1 + il.readInt8(offset))
|
|
3298
|
+
}))],
|
|
3299
|
+
["branch", fixed(4, (il, offset) => ({
|
|
3300
|
+
next: offset + 4,
|
|
3301
|
+
anchorKind: "branch",
|
|
3302
|
+
value: String(offset + 4 + il.readInt32LE(offset))
|
|
3303
|
+
}))]
|
|
3304
|
+
]);
|
|
3305
|
+
TOKEN_OPERAND_KINDS = new Map([
|
|
3306
|
+
["method", "method"],
|
|
3307
|
+
["field", "field"],
|
|
3308
|
+
["type", "type"],
|
|
3309
|
+
["string", "string"],
|
|
3310
|
+
["signature", "signature"]
|
|
3311
|
+
]);
|
|
3312
|
+
TOKEN_OPERAND_WIDTH = 4;
|
|
3313
|
+
operandExtent = (il, offset, kind) => {
|
|
3314
|
+
const fixedOperand = FIXED_OPERAND_READERS.get(kind);
|
|
3315
|
+
if (fixedOperand !== undefined) return fixedOperand.width;
|
|
3316
|
+
if (kind === "switch") {
|
|
3317
|
+
if (offset > il.length - 4) return null;
|
|
3318
|
+
return 4 + il.readUInt32LE(offset) * 4;
|
|
3319
|
+
}
|
|
3320
|
+
return TOKEN_OPERAND_KINDS.has(kind) || kind === "token" ? TOKEN_OPERAND_WIDTH : 0;
|
|
3321
|
+
};
|
|
3322
|
+
readOperand = (il, offset, kind) => {
|
|
3323
|
+
const fixedOperand = FIXED_OPERAND_READERS.get(kind);
|
|
3324
|
+
if (fixedOperand !== undefined) return fixedOperand.read(il, offset);
|
|
3325
|
+
if (kind === "switch") {
|
|
3326
|
+
const count = il.readUInt32LE(offset);
|
|
3327
|
+
return {
|
|
3328
|
+
next: offset + 4 + count * 4,
|
|
3329
|
+
anchorKind: "switch",
|
|
3330
|
+
value: String(count)
|
|
3331
|
+
};
|
|
3332
|
+
}
|
|
3333
|
+
if (!TOKEN_OPERAND_KINDS.has(kind) && kind !== "token") return {
|
|
3334
|
+
next: offset,
|
|
3335
|
+
anchorKind: "unknown",
|
|
3336
|
+
value: null
|
|
3337
|
+
};
|
|
3338
|
+
const raw = il.readUInt32LE(offset);
|
|
3339
|
+
const token = `0x${raw.toString(16).padStart(8, "0")}`;
|
|
3340
|
+
return {
|
|
3341
|
+
next: offset + TOKEN_OPERAND_WIDTH,
|
|
3342
|
+
anchorKind: TOKEN_OPERAND_KINDS.get(kind) ?? tokenKind(token),
|
|
3343
|
+
value: token
|
|
3344
|
+
};
|
|
3345
|
+
};
|
|
3346
|
+
decodeInstructions = (il, admitInstruction) => {
|
|
3347
|
+
const parsed = [];
|
|
3348
|
+
const instructionStarts = [];
|
|
3349
|
+
let offset = 0;
|
|
3350
|
+
let prefixStart = null;
|
|
3351
|
+
let issue = null;
|
|
3352
|
+
try {
|
|
3353
|
+
while (offset < il.length) {
|
|
3354
|
+
const start = offset;
|
|
3355
|
+
const first = il.readUInt8(offset);
|
|
3356
|
+
offset += 1;
|
|
3357
|
+
if (first === 254 && offset >= il.length) {
|
|
3358
|
+
issue = `Two-byte CIL opcode at IL offset ${String(start)} leaves method body`;
|
|
3359
|
+
break;
|
|
3360
|
+
}
|
|
3361
|
+
const code = first === 254 ? 65024 + il.readUInt8(offset++) : first;
|
|
3362
|
+
const descriptor = OPCODES.get(code);
|
|
3363
|
+
if (descriptor === undefined) {
|
|
3364
|
+
issue = `Unsupported CIL opcode 0x${code.toString(16)} at IL offset ${String(start)}`;
|
|
3365
|
+
break;
|
|
3366
|
+
}
|
|
3367
|
+
const extent = operandExtent(il, offset, descriptor.operand);
|
|
3368
|
+
if (extent === null || offset + extent > il.length) {
|
|
3369
|
+
issue = `Instruction ${descriptor.name} at IL offset ${String(start)} leaves method body`;
|
|
3370
|
+
break;
|
|
3371
|
+
}
|
|
3372
|
+
const operand = readOperand(il, offset, descriptor.operand);
|
|
3373
|
+
admitInstruction?.(start);
|
|
3374
|
+
offset = operand.next;
|
|
3375
|
+
if (PREFIX_OPCODES.has(descriptor.name)) {
|
|
3376
|
+
prefixStart ??= start;
|
|
3377
|
+
} else {
|
|
3378
|
+
instructionStarts.push(prefixStart ?? start);
|
|
3379
|
+
prefixStart = null;
|
|
3380
|
+
}
|
|
3381
|
+
parsed.push({
|
|
3382
|
+
offset: start,
|
|
3383
|
+
opcode: descriptor.name,
|
|
3384
|
+
operandKind: operand.anchorKind,
|
|
3385
|
+
operand: operand.value
|
|
3386
|
+
});
|
|
3387
|
+
}
|
|
3388
|
+
} catch (cause) {
|
|
3389
|
+
if (cause instanceof ManagedReaderFailure) throw cause;
|
|
3390
|
+
issue = cause instanceof Error ? cause.message : "Instruction decode failed";
|
|
3391
|
+
}
|
|
3392
|
+
const truncated = offset < il.length && issue === null ? 1 : 0;
|
|
3393
|
+
return {
|
|
3394
|
+
parsed,
|
|
3395
|
+
instructionStarts,
|
|
3396
|
+
count: parsed.length,
|
|
3397
|
+
truncated,
|
|
3398
|
+
issue
|
|
3399
|
+
};
|
|
3400
|
+
};
|
|
3401
|
+
parseExceptionRegions = (bytes, offset, methodEnd, budget) => {
|
|
3402
|
+
const regions = [];
|
|
3403
|
+
let sectionOffset = offset;
|
|
3404
|
+
let hasMoreSections = true;
|
|
3405
|
+
while (hasMoreSections) {
|
|
3406
|
+
if (!Number.isSafeInteger(sectionOffset) || sectionOffset < 0 || sectionOffset > methodEnd - 4 || sectionOffset > bytes.length - 4) return malformedExceptionRegions("Exception section header leaves artifact", regions);
|
|
3407
|
+
const kind = bytes.readUInt8(sectionOffset);
|
|
3408
|
+
if ((kind & 63) !== 1) return malformedExceptionRegions(`Unsupported method data section kind ${String(kind & 63)}`, regions);
|
|
3409
|
+
const fat = (kind & 64) !== 0;
|
|
3410
|
+
const size = fat ? bytes.readUInt8(sectionOffset + 1) | bytes.readUInt8(sectionOffset + 2) << 8 | bytes.readUInt8(sectionOffset + 3) << 16 : bytes.readUInt8(sectionOffset + 1);
|
|
3411
|
+
const clauseSize = fat ? 24 : 12;
|
|
3412
|
+
if (size < 4 || sectionOffset > methodEnd - size || sectionOffset > bytes.length - size) return malformedExceptionRegions("Exception section size leaves artifact", regions);
|
|
3413
|
+
let count;
|
|
3414
|
+
let sectionSize = size;
|
|
3415
|
+
if (fat) {
|
|
3416
|
+
if ((size - 4) % clauseSize !== 0) return malformedExceptionRegions("Exception section size does not contain whole clauses", regions);
|
|
3417
|
+
count = (size - 4) / clauseSize;
|
|
3418
|
+
} else if ((size - 4) % clauseSize === 0) {
|
|
3419
|
+
count = (size - 4) / clauseSize;
|
|
3420
|
+
} else if (size >= clauseSize && size % clauseSize === 0) {
|
|
3421
|
+
count = size / clauseSize;
|
|
3422
|
+
sectionSize = 4 + count * clauseSize;
|
|
3423
|
+
} else {
|
|
3424
|
+
return malformedExceptionRegions("Exception section size does not contain whole clauses", regions);
|
|
3425
|
+
}
|
|
3426
|
+
if (sectionOffset > methodEnd - sectionSize || sectionOffset > bytes.length - sectionSize) return malformedExceptionRegions("Exception section size leaves artifact", regions);
|
|
3427
|
+
if (!fat && (bytes[sectionOffset + 2] !== 0 || bytes[sectionOffset + 3] !== 0)) return malformedExceptionRegions("Small exception section reserved bytes are nonzero", regions);
|
|
3428
|
+
budget?.admitTransient(count * 256, sectionOffset);
|
|
3429
|
+
for (const region of readExceptionClauses(bytes, sectionOffset + 4, count, fat)) regions.push(region);
|
|
3430
|
+
hasMoreSections = (kind & 128) !== 0;
|
|
3431
|
+
sectionOffset += sectionSize;
|
|
3432
|
+
}
|
|
3433
|
+
return {
|
|
3434
|
+
status: "complete",
|
|
3435
|
+
regions
|
|
3436
|
+
};
|
|
3437
|
+
};
|
|
3438
|
+
malformedExceptionRegions = (issue, regions = []) => ({
|
|
3439
|
+
status: "malformed",
|
|
3440
|
+
regions,
|
|
3441
|
+
issue
|
|
3442
|
+
});
|
|
3443
|
+
readExceptionClauses = (bytes, start, count, fat) => {
|
|
3444
|
+
const regions = [];
|
|
3445
|
+
const clauseSize = fat ? 24 : 12;
|
|
3446
|
+
for (let index = 0; index < count; index += 1) {
|
|
3447
|
+
const clause = start + index * clauseSize;
|
|
3448
|
+
const flags = fat ? bytes.readUInt32LE(clause) : bytes.readUInt16LE(clause);
|
|
3449
|
+
const extra = bytes.readUInt32LE(clause + (fat ? 20 : 8));
|
|
3450
|
+
regions.push({
|
|
3451
|
+
flags,
|
|
3452
|
+
try_offset: fat ? bytes.readUInt32LE(clause + 4) : bytes.readUInt16LE(clause + 2),
|
|
3453
|
+
try_length: fat ? bytes.readUInt32LE(clause + 8) : bytes.readUInt8(clause + 4),
|
|
3454
|
+
handler_offset: fat ? bytes.readUInt32LE(clause + 12) : bytes.readUInt16LE(clause + 5),
|
|
3455
|
+
handler_length: fat ? bytes.readUInt32LE(clause + 16) : bytes.readUInt8(clause + 7),
|
|
3456
|
+
class_token: flags === 0 ? `0x${extra.toString(16).padStart(8, "0")}` : null,
|
|
3457
|
+
filter_offset: flags === 1 ? extra : null
|
|
3458
|
+
});
|
|
3459
|
+
}
|
|
3460
|
+
return regions;
|
|
3461
|
+
};
|
|
3462
|
+
})))();
|
|
3463
|
+
}
|
|
3464
|
+
|
|
3465
|
+
//#endregion
|
|
3466
|
+
//#region dist/dotnet/ManagedExceptionRegionValidation.js
|
|
3467
|
+
var clauseFlagsIssue, methodExtentIssue, instructionBoundaryIssue, filterOrderingIssue, clauseIssue, validateExceptionRegionRanges;
|
|
3468
|
+
function init_ManagedExceptionRegionValidation() {
|
|
3469
|
+
return (init_ManagedExceptionRegionValidation = __esmMin((() => {
|
|
3470
|
+
clauseFlagsIssue = (region) => [
|
|
3471
|
+
0,
|
|
3472
|
+
1,
|
|
3473
|
+
2,
|
|
3474
|
+
4
|
|
3475
|
+
].includes(region.flags) ? null : `Exception clause has unsupported flags 0x${region.flags.toString(16)}`;
|
|
3476
|
+
methodExtentIssue = (start, length, ilSize, name) => start <= ilSize && length <= ilSize - start ? null : `Exception clause ${name} range leaves the method IL body`;
|
|
3477
|
+
instructionBoundaryIssue = (start, length, boundaries, name) => {
|
|
3478
|
+
const end = start + length;
|
|
3479
|
+
return boundaries.has(start) && boundaries.has(end) ? null : `Exception clause ${name} range does not align with CIL instruction boundaries`;
|
|
3480
|
+
};
|
|
3481
|
+
filterOrderingIssue = (region, ilSize) => {
|
|
3482
|
+
if (region.flags !== 1) return null;
|
|
3483
|
+
const offset = region.filter_offset;
|
|
3484
|
+
return offset !== null && offset < ilSize && offset < region.handler_offset ? null : "Exception clause filter must start before its handler within the method IL body";
|
|
3485
|
+
};
|
|
3486
|
+
clauseIssue = (region, ilSize, boundaries) => clauseFlagsIssue(region) ?? methodExtentIssue(region.try_offset, region.try_length, ilSize, "try") ?? instructionBoundaryIssue(region.try_offset, region.try_length, boundaries, "try") ?? methodExtentIssue(region.handler_offset, region.handler_length, ilSize, "handler") ?? instructionBoundaryIssue(region.handler_offset, region.handler_length, boundaries, "handler") ?? (region.flags === 1 && region.filter_offset !== null ? instructionBoundaryIssue(region.filter_offset, 0, boundaries, "filter") : null) ?? filterOrderingIssue(region, ilSize);
|
|
3487
|
+
validateExceptionRegionRanges = (parsed, ilSize, instructionOffsets) => {
|
|
3488
|
+
if (parsed.status === "malformed") return parsed;
|
|
3489
|
+
const boundaries = new Set([...instructionOffsets, ilSize]);
|
|
3490
|
+
for (const region of parsed.regions) {
|
|
3491
|
+
const issue = clauseIssue(region, ilSize, boundaries);
|
|
3492
|
+
if (issue !== null) return {
|
|
3493
|
+
status: "malformed",
|
|
3494
|
+
regions: parsed.regions,
|
|
3495
|
+
issue
|
|
3496
|
+
};
|
|
3497
|
+
}
|
|
3498
|
+
return parsed;
|
|
3499
|
+
};
|
|
3500
|
+
})))();
|
|
3501
|
+
}
|
|
3502
|
+
|
|
3503
|
+
//#endregion
|
|
3504
|
+
//#region dist/dotnet/ManagedMethodBodyReader.js
|
|
3505
|
+
var bodyStatus, readMethodBodyHeader, methodBody, emptyMethodBody;
|
|
3506
|
+
function init_ManagedMethodBodyReader() {
|
|
3507
|
+
return (init_ManagedMethodBodyReader = __esmMin((() => {
|
|
3508
|
+
init_ManagedDecodeBudget();
|
|
3509
|
+
init_ManagedMemberInstructionDecoder();
|
|
3510
|
+
init_ManagedExceptionRegionValidation();
|
|
3511
|
+
init_ManagedMetadataHeaps();
|
|
3512
|
+
init_ManagedReaderFailure();
|
|
3513
|
+
bodyStatus = (decodedIssue, truncatedInstructions, exceptionRegions) => {
|
|
3514
|
+
if (decodedIssue !== null || exceptionRegions?.status === "malformed") return "malformed";
|
|
3515
|
+
if (truncatedInstructions > 0) return "partial";
|
|
3516
|
+
return "present";
|
|
3517
|
+
};
|
|
3518
|
+
readMethodBodyHeader = (bytes, offset) => {
|
|
3519
|
+
const first = bytes.readUInt8(offset);
|
|
3520
|
+
if ((first & 3) === 2) return {
|
|
3521
|
+
format: "tiny",
|
|
3522
|
+
size: 1,
|
|
3523
|
+
flags: 0,
|
|
3524
|
+
maxStack: 8,
|
|
3525
|
+
ilSize: first >> 2,
|
|
3526
|
+
localSig: 0
|
|
3527
|
+
};
|
|
3528
|
+
if ((first & 3) !== 3) throw new RangeError("Unsupported method body header");
|
|
3529
|
+
if (offset > bytes.length - 12) throw new RangeError("Fat method body header leaves artifact");
|
|
3530
|
+
const flagsAndSize = bytes.readUInt16LE(offset);
|
|
3531
|
+
const headerDwords = flagsAndSize >>> 12;
|
|
3532
|
+
if (headerDwords < 3) throw new RangeError("Fat method body header is smaller than 12 bytes");
|
|
3533
|
+
const size = headerDwords * 4;
|
|
3534
|
+
if (offset > bytes.length - size) throw new RangeError("Method body header leaves artifact");
|
|
3535
|
+
return {
|
|
3536
|
+
format: "fat",
|
|
3537
|
+
size,
|
|
3538
|
+
flags: flagsAndSize & 4095,
|
|
3539
|
+
maxStack: bytes.readUInt16LE(offset + 2),
|
|
3540
|
+
ilSize: bytes.readUInt32LE(offset + 4),
|
|
3541
|
+
localSig: bytes.readUInt32LE(offset + 8)
|
|
3542
|
+
};
|
|
3543
|
+
};
|
|
3544
|
+
methodBody = (bytes, pe, rva, implementation = {
|
|
3545
|
+
implFlags: 0,
|
|
3546
|
+
flags: 0
|
|
3547
|
+
}, budget) => {
|
|
3548
|
+
if (rva === 0) return {
|
|
3549
|
+
body: emptyMethodBody(rva, "absent", null),
|
|
3550
|
+
scanned: true
|
|
3551
|
+
};
|
|
3552
|
+
const native = (implementation.implFlags & 7) !== 0 || (implementation.flags & 8192) !== 0;
|
|
3553
|
+
if (native) {
|
|
3554
|
+
const issue = "CIL decoding is unavailable for native, runtime, unmanaged, or P/Invoke implementations";
|
|
3555
|
+
return {
|
|
3556
|
+
body: emptyMethodBody(rva, "partial", issue),
|
|
3557
|
+
scanned: true
|
|
3558
|
+
};
|
|
3559
|
+
}
|
|
3560
|
+
try {
|
|
3561
|
+
const offset = pe.rvaToOffset(rva, 1, "method.body");
|
|
3562
|
+
const methodExtent = pe.rvaAvailableBytes(rva, "method.body");
|
|
3563
|
+
const header = readMethodBodyHeader(bytes, offset);
|
|
3564
|
+
if (header.size > methodExtent || header.ilSize > methodExtent - header.size) throw new RangeError("Method body leaves file-backed PE section data");
|
|
3565
|
+
const ilOffset = offset + header.size;
|
|
3566
|
+
if (ilOffset > bytes.length - header.ilSize) throw new RangeError("Method IL bytes leave artifact");
|
|
3567
|
+
const il = bytes.subarray(ilOffset, ilOffset + header.ilSize);
|
|
3568
|
+
const decoded = decodeInstructions(il, budget === undefined ? undefined : (start) => budget.admitTransient(256, ilOffset + start));
|
|
3569
|
+
const opcodeCounts = {};
|
|
3570
|
+
for (const instruction of decoded.parsed) opcodeCounts[instruction.opcode] = (opcodeCounts[instruction.opcode] ?? 0) + 1;
|
|
3571
|
+
const anchors = decoded.parsed.filter((instruction) => instruction.operandKind !== "none").map((instruction) => ({
|
|
3572
|
+
il_offset: instruction.offset,
|
|
3573
|
+
opcode: instruction.opcode,
|
|
3574
|
+
operand_kind: instruction.operandKind,
|
|
3575
|
+
operand: instruction.operand
|
|
3576
|
+
}));
|
|
3577
|
+
const normalized = Buffer.from(JSON.stringify(decoded.parsed.map(({ opcode, operandKind, operand }) => [
|
|
3578
|
+
opcode,
|
|
3579
|
+
operandKind,
|
|
3580
|
+
operand
|
|
3581
|
+
])), "utf8");
|
|
3582
|
+
const methodEnd = ilOffset + header.ilSize;
|
|
3583
|
+
const sectionOffset = Math.ceil(methodEnd / 4) * 4;
|
|
3584
|
+
const exceptionRegions = header.format === "fat" && (header.flags & 8) !== 0 ? validateExceptionRegionRanges(parseExceptionRegions(bytes, sectionOffset, offset + methodExtent, budget), header.ilSize, decoded.instructionStarts) : null;
|
|
3585
|
+
const status = bodyStatus(decoded.issue, decoded.truncated, exceptionRegions);
|
|
3586
|
+
const body = {
|
|
3587
|
+
status,
|
|
3588
|
+
header_format: header.format,
|
|
3589
|
+
rva,
|
|
3590
|
+
file_offset: offset,
|
|
3591
|
+
max_stack: header.maxStack,
|
|
3592
|
+
init_locals: (header.flags & 16) !== 0,
|
|
3593
|
+
local_var_sig_token: header.localSig === 0 ? null : `0x${header.localSig.toString(16).padStart(8, "0")}`,
|
|
3594
|
+
il_size: header.ilSize,
|
|
3595
|
+
il_sha256: sha256Bytes(il),
|
|
3596
|
+
normalized_il_sha256: status === "present" ? sha256Bytes(normalized) : null,
|
|
3597
|
+
instruction_count: decoded.count,
|
|
3598
|
+
decoded_instruction_count: decoded.parsed.length,
|
|
3599
|
+
truncated_instructions: decoded.truncated,
|
|
3600
|
+
opcode_counts: opcodeCounts,
|
|
3601
|
+
anchors,
|
|
3602
|
+
exception_regions: exceptionRegions?.regions ?? [],
|
|
3603
|
+
issue: decoded.issue ?? (exceptionRegions?.status === "malformed" ? exceptionRegions.issue : null) ?? (decoded.truncated > 0 ? "Instruction decoding stopped before the end of the method body" : null)
|
|
3604
|
+
};
|
|
3605
|
+
return {
|
|
3606
|
+
body: budget === undefined ? body : admitManagedProjection(body, budget),
|
|
3607
|
+
scanned: decoded.issue === null && decoded.truncated === 0
|
|
3608
|
+
};
|
|
3609
|
+
} catch (cause) {
|
|
3610
|
+
if (cause instanceof ManagedReaderFailure && cause.issue.code === "resource-limit") throw cause;
|
|
3611
|
+
if (!(cause instanceof ManagedReaderFailure) && !(cause instanceof RangeError)) throw cause;
|
|
3612
|
+
return {
|
|
3613
|
+
body: emptyMethodBody(rva, "malformed", cause instanceof Error ? cause.message : "Method body parse failed"),
|
|
3614
|
+
scanned: false
|
|
3615
|
+
};
|
|
3616
|
+
} finally {
|
|
3617
|
+
budget?.releaseTransient();
|
|
3618
|
+
}
|
|
3619
|
+
};
|
|
3620
|
+
emptyMethodBody = (rva, status, issue) => ({
|
|
3621
|
+
status,
|
|
3622
|
+
header_format: status === "absent" ? "none" : "unknown",
|
|
3623
|
+
rva,
|
|
3624
|
+
file_offset: null,
|
|
3625
|
+
max_stack: null,
|
|
3626
|
+
init_locals: null,
|
|
3627
|
+
local_var_sig_token: null,
|
|
3628
|
+
il_size: 0,
|
|
3629
|
+
il_sha256: null,
|
|
3630
|
+
normalized_il_sha256: null,
|
|
3631
|
+
instruction_count: 0,
|
|
3632
|
+
decoded_instruction_count: 0,
|
|
3633
|
+
truncated_instructions: 0,
|
|
3634
|
+
opcode_counts: {},
|
|
3635
|
+
anchors: [],
|
|
3636
|
+
exception_regions: [],
|
|
3637
|
+
issue
|
|
3638
|
+
});
|
|
3639
|
+
})))();
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3642
|
+
//#endregion
|
|
3643
|
+
//#region dist/dotnet/ManagedMemberRows.js
|
|
3644
|
+
var isSelected, parseFields, TYPE_FORWARDER_FLAG, parseExportedTypes, parseMemberRefs, parseMethods, NAMEABLE_KINDS, targetKind, namedTarget, edges, callerName, callerNameBytes, budgetedSignature;
|
|
3645
|
+
function init_ManagedMemberRows() {
|
|
3646
|
+
return (init_ManagedMemberRows = __esmMin((() => {
|
|
3647
|
+
init_ManagedDecodeBudget();
|
|
3648
|
+
init_ManagedMemberInspectorCore();
|
|
3649
|
+
init_ManagedMetadataHeaps();
|
|
3650
|
+
init_ManagedReaderFailure();
|
|
3651
|
+
init_ManagedMethodBodyReader();
|
|
3652
|
+
init_ManagedMemberOwnership();
|
|
3653
|
+
isSelected = (selected, declared) => selected === null || declared !== undefined && selected.has(declared.token);
|
|
3654
|
+
parseFields = (bytes, layout, ranges, memberLists, selected = null) => {
|
|
3655
|
+
const fields = [];
|
|
3656
|
+
const core = new Map();
|
|
3657
|
+
const issues = [];
|
|
3658
|
+
const table = layout.table(4);
|
|
3659
|
+
const ownerRow = readManagedValue(() => memberDeclaringTypeRowLookup(bytes, layout, 4, memberLists), issues);
|
|
3660
|
+
for (let row = 1; row <= (table?.rowCount ?? 0); row += 1) {
|
|
3661
|
+
readManagedValue(() => {
|
|
3662
|
+
const cursor = metadataRowCursor(bytes, layout, 4, row);
|
|
3663
|
+
const flags = cursor.readUInt16();
|
|
3664
|
+
const name = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), layout.strings.size);
|
|
3665
|
+
const owner = ownerRow === undefined ? 0 : readManagedValue(() => ownerRow(row), issues) ?? 0;
|
|
3666
|
+
const declared = ranges[owner - 1];
|
|
3667
|
+
const token = metadataToken(4, row);
|
|
3668
|
+
core.set(token, {
|
|
3669
|
+
token,
|
|
3670
|
+
name,
|
|
3671
|
+
declaringType: declared?.fullName ?? null,
|
|
3672
|
+
kind: "field"
|
|
3673
|
+
});
|
|
3674
|
+
if (!isSelected(selected, declared)) return;
|
|
3675
|
+
const sig = readMetadataBlob(bytes, layout, cursor.readIndex(layout.blobIndexSize), layout.blob.size);
|
|
3676
|
+
fields.push({
|
|
3677
|
+
token,
|
|
3678
|
+
row_offset: cursor.start,
|
|
3679
|
+
declaring_type_token: declared?.token ?? null,
|
|
3680
|
+
declaring_type: declared?.fullName ?? null,
|
|
3681
|
+
name,
|
|
3682
|
+
flags,
|
|
3683
|
+
signature: budgetedSignature(sig, layout)
|
|
3684
|
+
});
|
|
3685
|
+
}, issues);
|
|
3686
|
+
}
|
|
3687
|
+
return {
|
|
3688
|
+
fields,
|
|
3689
|
+
core,
|
|
3690
|
+
issues
|
|
3691
|
+
};
|
|
3692
|
+
};
|
|
3693
|
+
TYPE_FORWARDER_FLAG = 2097152;
|
|
3694
|
+
parseExportedTypes = (bytes, layout) => {
|
|
3695
|
+
const exportedTypes = [];
|
|
3696
|
+
const issues = [];
|
|
3697
|
+
const table = layout.table(39);
|
|
3698
|
+
for (let row = 1; row <= (table?.rowCount ?? 0); row += 1) {
|
|
3699
|
+
readManagedValue(() => {
|
|
3700
|
+
const cursor = metadataRowCursor(bytes, layout, 39, row);
|
|
3701
|
+
const flags = cursor.readUInt32();
|
|
3702
|
+
const typeDefId = cursor.readUInt32();
|
|
3703
|
+
const name = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), layout.strings.size);
|
|
3704
|
+
const namespace = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), layout.strings.size);
|
|
3705
|
+
const implementationOffset = cursor.offset;
|
|
3706
|
+
const implementationRaw = cursor.readIndex(layout.codedIndexSize("Implementation"));
|
|
3707
|
+
const token = metadataToken(39, row);
|
|
3708
|
+
const implementationReason = metadataCodedTokenInvalidReason(implementationRaw, 2, [
|
|
3709
|
+
38,
|
|
3710
|
+
35,
|
|
3711
|
+
39
|
|
3712
|
+
], layout.rowCounts);
|
|
3713
|
+
if (implementationReason !== null || implementationRaw === 0) issues.push({
|
|
3714
|
+
code: "invalid-row",
|
|
3715
|
+
scope: `metadata.ExportedType:${token}`,
|
|
3716
|
+
offset: implementationOffset,
|
|
3717
|
+
detail: implementationReason === null ? "ExportedType implementation coded index 0x0 is null, but the Implementation column must reference a row" : `ExportedType implementation coded index 0x${implementationRaw.toString(16)} is invalid: ${implementationReason}`
|
|
3718
|
+
});
|
|
3719
|
+
exportedTypes.push({
|
|
3720
|
+
token,
|
|
3721
|
+
row_offset: cursor.start,
|
|
3722
|
+
namespace,
|
|
3723
|
+
name,
|
|
3724
|
+
flags,
|
|
3725
|
+
forwarder: (flags & TYPE_FORWARDER_FLAG) !== 0,
|
|
3726
|
+
type_def_id: typeDefId,
|
|
3727
|
+
implementation_token: metadataCodedToken(implementationRaw, 2, [
|
|
3728
|
+
38,
|
|
3729
|
+
35,
|
|
3730
|
+
39
|
|
3731
|
+
], layout.rowCounts)
|
|
3732
|
+
});
|
|
3733
|
+
}, issues);
|
|
3734
|
+
}
|
|
3735
|
+
return {
|
|
3736
|
+
exportedTypes,
|
|
3737
|
+
issues
|
|
3738
|
+
};
|
|
3739
|
+
};
|
|
3740
|
+
parseMemberRefs = (bytes, layout, typeName) => {
|
|
3741
|
+
const refs = [];
|
|
3742
|
+
const core = new Map();
|
|
3743
|
+
const issues = [];
|
|
3744
|
+
const table = layout.table(10);
|
|
3745
|
+
for (let row = 1; row <= (table?.rowCount ?? 0); row += 1) {
|
|
3746
|
+
readManagedValue(() => {
|
|
3747
|
+
const cursor = metadataRowCursor(bytes, layout, 10, row);
|
|
3748
|
+
const parentRaw = cursor.readIndex(layout.codedIndexSize("MemberRefParent"));
|
|
3749
|
+
const name = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), layout.strings.size);
|
|
3750
|
+
const sig = readMetadataBlob(bytes, layout, cursor.readIndex(layout.blobIndexSize), layout.blob.size);
|
|
3751
|
+
const token = metadataToken(10, row);
|
|
3752
|
+
const parentReason = metadataCodedTokenInvalidReason(parentRaw, 3, [
|
|
3753
|
+
2,
|
|
3754
|
+
1,
|
|
3755
|
+
26,
|
|
3756
|
+
6,
|
|
3757
|
+
27
|
|
3758
|
+
], layout.rowCounts);
|
|
3759
|
+
if (parentReason !== null || parentRaw === 0) issues.push({
|
|
3760
|
+
code: "invalid-row",
|
|
3761
|
+
scope: `metadata.MemberRef:${token}`,
|
|
3762
|
+
offset: cursor.start,
|
|
3763
|
+
detail: parentReason === null ? "MemberRef parent coded index 0x0 is null, but the Class column must reference a row" : `MemberRef parent coded index 0x${parentRaw.toString(16)} is invalid: ${parentReason}`
|
|
3764
|
+
});
|
|
3765
|
+
const parentToken = metadataCodedToken(parentRaw, 3, [
|
|
3766
|
+
2,
|
|
3767
|
+
1,
|
|
3768
|
+
26,
|
|
3769
|
+
6,
|
|
3770
|
+
27
|
|
3771
|
+
], layout.rowCounts);
|
|
3772
|
+
const parentName = typeName(parentToken);
|
|
3773
|
+
const decoded = budgetedSignature(sig, layout);
|
|
3774
|
+
refs.push({
|
|
3775
|
+
token,
|
|
3776
|
+
row_offset: cursor.start,
|
|
3777
|
+
parent_token: parentToken,
|
|
3778
|
+
parent_name: parentName,
|
|
3779
|
+
name,
|
|
3780
|
+
signature: decoded
|
|
3781
|
+
});
|
|
3782
|
+
core.set(token, {
|
|
3783
|
+
token,
|
|
3784
|
+
name,
|
|
3785
|
+
declaringType: parentName,
|
|
3786
|
+
kind: decoded.kind,
|
|
3787
|
+
genericArity: signatureGenericArity(decoded)
|
|
3788
|
+
});
|
|
3789
|
+
}, issues);
|
|
3790
|
+
}
|
|
3791
|
+
return {
|
|
3792
|
+
refs,
|
|
3793
|
+
core,
|
|
3794
|
+
issues
|
|
3795
|
+
};
|
|
3796
|
+
};
|
|
3797
|
+
parseMethods = ({ bytes, layout, pe, ranges, memberLists, selected = null, methodOffset = 0, methodLimit = Number.MAX_SAFE_INTEGER }) => {
|
|
3798
|
+
const methods = [];
|
|
3799
|
+
const core = new Map();
|
|
3800
|
+
const issues = [];
|
|
3801
|
+
let unscannedMethods = 0;
|
|
3802
|
+
const table = layout.table(6);
|
|
3803
|
+
const ownerRow = readManagedValue(() => memberDeclaringTypeRowLookup(bytes, layout, 6, memberLists), issues);
|
|
3804
|
+
for (let row = 1; row <= (table?.rowCount ?? 0); row += 1) {
|
|
3805
|
+
const owner = ownerRow === undefined ? undefined : readManagedValue(() => ownerRow(row), issues);
|
|
3806
|
+
const declared = owner === undefined ? undefined : ranges[owner - 1];
|
|
3807
|
+
const inPage = row > methodOffset && row - methodOffset <= methodLimit;
|
|
3808
|
+
const mayBeSelected = inPage && (selected === null || owner === undefined || isSelected(selected, declared) || declared?.fullName === null);
|
|
3809
|
+
const produced = methods.length;
|
|
3810
|
+
readManagedValue(() => {
|
|
3811
|
+
const cursor = metadataRowCursor(bytes, layout, 6, row);
|
|
3812
|
+
const rva = cursor.readUInt32();
|
|
3813
|
+
const implFlags = cursor.readUInt16();
|
|
3814
|
+
const flags = cursor.readUInt16();
|
|
3815
|
+
const name = readMetadataString(bytes, layout, cursor.readIndex(layout.stringIndexSize), layout.strings.size);
|
|
3816
|
+
const token = metadataToken(6, row);
|
|
3817
|
+
const member = {
|
|
3818
|
+
token,
|
|
3819
|
+
name,
|
|
3820
|
+
declaringType: declared?.fullName ?? null,
|
|
3821
|
+
kind: "method"
|
|
3822
|
+
};
|
|
3823
|
+
core.set(token, member);
|
|
3824
|
+
if (!inPage) return;
|
|
3825
|
+
if (!isSelected(selected, declared)) return;
|
|
3826
|
+
const sig = readMetadataBlob(bytes, layout, cursor.readIndex(layout.blobIndexSize), layout.blob.size);
|
|
3827
|
+
cursor.readIndex(layout.tableIndexSize(8));
|
|
3828
|
+
const decoded = budgetedSignature(sig, layout);
|
|
3829
|
+
core.set(token, {
|
|
3830
|
+
...member,
|
|
3831
|
+
genericArity: signatureGenericArity(decoded)
|
|
3832
|
+
});
|
|
3833
|
+
const read = methodBody(bytes, pe, rva, {
|
|
3834
|
+
implFlags,
|
|
3835
|
+
flags
|
|
3836
|
+
}, managedDecodeBudget(layout));
|
|
3837
|
+
if (!read.scanned) unscannedMethods += 1;
|
|
3838
|
+
methods.push({
|
|
3839
|
+
token,
|
|
3840
|
+
row_offset: cursor.start,
|
|
3841
|
+
declaring_type_token: declared?.token ?? null,
|
|
3842
|
+
declaring_type: declared?.fullName ?? null,
|
|
3843
|
+
name,
|
|
3844
|
+
rva,
|
|
3845
|
+
impl_flags: implFlags,
|
|
3846
|
+
flags,
|
|
3847
|
+
signature: decoded,
|
|
3848
|
+
body: read.body
|
|
3849
|
+
});
|
|
3850
|
+
}, issues);
|
|
3851
|
+
if (mayBeSelected && methods.length === produced) unscannedMethods += 1;
|
|
3852
|
+
}
|
|
3853
|
+
return {
|
|
3854
|
+
methods,
|
|
3855
|
+
core,
|
|
3856
|
+
issues,
|
|
3857
|
+
unscannedMethods
|
|
3858
|
+
};
|
|
3859
|
+
};
|
|
3860
|
+
NAMEABLE_KINDS = new Map([["method", new Set(["method", "unknown"])], ["field", new Set(["field"])]]);
|
|
3861
|
+
targetKind = (token) => token.startsWith("0x06") ? "method-def" : token.startsWith("0x0a") ? "member-ref" : token.startsWith("0x2b") ? "method-spec" : "unknown";
|
|
3862
|
+
namedTarget = (members, operandKind, operand) => {
|
|
3863
|
+
const member = members.get(operand);
|
|
3864
|
+
return member !== undefined && NAMEABLE_KINDS.get(operandKind)?.has(member.kind) === true ? member : undefined;
|
|
3865
|
+
};
|
|
3866
|
+
edges = (methods, members, budget) => {
|
|
3867
|
+
const callEdges = [];
|
|
3868
|
+
const fieldAccesses = [];
|
|
3869
|
+
for (const method of methods) {
|
|
3870
|
+
const derives = method.body.anchors.some((anchor) => anchor.opcode !== "ldtoken" && anchor.operand !== null && (anchor.operand_kind === "method" || anchor.operand_kind === "field"));
|
|
3871
|
+
if (derives) budget.admitTransient(callerNameBytes(method), null);
|
|
3872
|
+
const caller = derives ? callerName(method) : method.name;
|
|
3873
|
+
for (const anchor of method.body.anchors) {
|
|
3874
|
+
if (anchor.opcode === "ldtoken") continue;
|
|
3875
|
+
const { operand } = anchor;
|
|
3876
|
+
if (operand === null) continue;
|
|
3877
|
+
const target = namedTarget(members, anchor.operand_kind, operand);
|
|
3878
|
+
if (anchor.operand_kind === "method") {
|
|
3879
|
+
callEdges.push(admitManagedProjection({
|
|
3880
|
+
caller_token: method.token,
|
|
3881
|
+
caller,
|
|
3882
|
+
opcode: anchor.opcode,
|
|
3883
|
+
target_token: operand,
|
|
3884
|
+
target_kind: targetKind(operand),
|
|
3885
|
+
target_name: target?.name ?? null,
|
|
3886
|
+
target_declaring_type: target?.declaringType ?? null
|
|
3887
|
+
}, budget));
|
|
3888
|
+
}
|
|
3889
|
+
if (anchor.operand_kind === "field") {
|
|
3890
|
+
fieldAccesses.push(admitManagedProjection({
|
|
3891
|
+
method_token: method.token,
|
|
3892
|
+
method: caller,
|
|
3893
|
+
opcode: anchor.opcode,
|
|
3894
|
+
field_token: operand,
|
|
3895
|
+
field_name: target?.name ?? null,
|
|
3896
|
+
field_declaring_type: target?.declaringType ?? null
|
|
3897
|
+
}, budget));
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
if (derives) budget.releaseTransient();
|
|
3901
|
+
}
|
|
3902
|
+
return {
|
|
3903
|
+
callEdges,
|
|
3904
|
+
fieldAccesses
|
|
3905
|
+
};
|
|
3906
|
+
};
|
|
3907
|
+
callerName = (method) => method.declaring_type === null ? method.name : `${method.declaring_type}.${method.name}`;
|
|
3908
|
+
callerNameBytes = (method) => method.declaring_type === null ? managedJsonStringBytes(method.name) : managedJsonStringBytes(method.declaring_type) + managedJsonStringBytes(method.name) - 1;
|
|
3909
|
+
budgetedSignature = (bytes, layout) => {
|
|
3910
|
+
const budget = managedDecodeBudget(layout);
|
|
3911
|
+
budget.admitTransient(bytes.length * 256, layout.blob.offset);
|
|
3912
|
+
try {
|
|
3913
|
+
return admitManagedProjection(signature(bytes, budget.digest(bytes, "sha256")), budget);
|
|
3914
|
+
} finally {
|
|
3915
|
+
budget.releaseTransient();
|
|
3916
|
+
}
|
|
3917
|
+
};
|
|
3918
|
+
})))();
|
|
3919
|
+
}
|
|
3920
|
+
|
|
3921
|
+
//#endregion
|
|
3922
|
+
//#region dist/dotnet/ManagedMemberInspector.js
|
|
3923
|
+
var unavailable, readMemberInventory, selectTypes, inspectManagedMembersBytes;
|
|
3924
|
+
function init_ManagedMemberInspector() {
|
|
3925
|
+
return (init_ManagedMemberInspector = __esmMin((() => {
|
|
3926
|
+
init_ManagedDecodeBudget();
|
|
3927
|
+
init_managedArtifact();
|
|
3928
|
+
init_ManagedPeReader();
|
|
3929
|
+
init_ManagedMetadataInventory();
|
|
3930
|
+
init_ManagedMetadataLayout();
|
|
3931
|
+
init_ManagedReaderFailure();
|
|
3932
|
+
init_ManagedMemberInspectorCore();
|
|
3933
|
+
init_ManagedMethodSpecs();
|
|
3934
|
+
init_ManagedTypeNames();
|
|
3935
|
+
init_ManagedUserStrings();
|
|
3936
|
+
init_ManagedTypeMemberLists();
|
|
3937
|
+
init_ManagedMemberRows();
|
|
3938
|
+
unavailable = (target, bytes, issue, typeNames) => managedMemberInspectionSchema.parse(admitManagedProjection({
|
|
3939
|
+
artifact: {
|
|
3940
|
+
path: target.path,
|
|
3941
|
+
sha256: target.sha256,
|
|
3942
|
+
byte_length: bytes.length,
|
|
3943
|
+
format: "pe"
|
|
3944
|
+
},
|
|
3945
|
+
module: null,
|
|
3946
|
+
metadata: {
|
|
3947
|
+
status: issue === null ? "absent" : issue.code === "resource-limit" ? "partial" : "malformed",
|
|
3948
|
+
version: null,
|
|
3949
|
+
table_row_counts: {}
|
|
3950
|
+
},
|
|
3951
|
+
identity_scope: {
|
|
3952
|
+
token_identity: "build-local",
|
|
3953
|
+
requires_artifact_sha256: target.sha256,
|
|
3954
|
+
requires_mvid: null
|
|
3955
|
+
},
|
|
3956
|
+
types: [],
|
|
3957
|
+
exported_types: null,
|
|
3958
|
+
user_strings: null,
|
|
3959
|
+
fields: [],
|
|
3960
|
+
methods: [],
|
|
3961
|
+
member_refs: [],
|
|
3962
|
+
call_edges: [],
|
|
3963
|
+
field_accesses: [],
|
|
3964
|
+
selection: typeNames === undefined ? null : {
|
|
3965
|
+
type_names: [...typeNames],
|
|
3966
|
+
unmatched_type_names: []
|
|
3967
|
+
},
|
|
3968
|
+
coverage: {
|
|
3969
|
+
state: "unavailable",
|
|
3970
|
+
issues: issue === null ? [] : [issue]
|
|
3971
|
+
},
|
|
3972
|
+
limitations: [issue === null ? "The PE has no admitted CLI metadata; managed member inspection is unavailable." : "The CLI metadata could not be admitted; managed member inspection is unavailable."]
|
|
3973
|
+
}));
|
|
3974
|
+
readMemberInventory = (bytes, pe, issues) => {
|
|
3975
|
+
const cli = pe.cli;
|
|
3976
|
+
if (cli === null) throw new TypeError("Managed inventory requires CLI metadata");
|
|
3977
|
+
const rootOffset = pe.rvaToOffset(cli.metadata.rva, cli.metadata.size, "cli.metadata");
|
|
3978
|
+
const layout = readManagedMetadataLayout(bytes, rootOffset, cli.metadata.size);
|
|
3979
|
+
const memberLists = readTypeMemberListFacts(bytes, layout);
|
|
3980
|
+
const inventory = readManagedMetadataInventory(bytes, layout, readManagedResourceDirectory(pe, issues), memberLists);
|
|
3981
|
+
return {
|
|
3982
|
+
layout,
|
|
3983
|
+
inventory,
|
|
3984
|
+
memberLists
|
|
3985
|
+
};
|
|
3986
|
+
};
|
|
3987
|
+
selectTypes = (ranges, typeNames) => {
|
|
3988
|
+
if (typeNames === undefined) return {
|
|
3989
|
+
tokens: null,
|
|
3990
|
+
selection: null,
|
|
3991
|
+
unreadableNames: 0
|
|
3992
|
+
};
|
|
3993
|
+
const requested = new Set(typeNames);
|
|
3994
|
+
const tokens = new Set();
|
|
3995
|
+
const matched = new Set();
|
|
3996
|
+
for (const range of ranges) {
|
|
3997
|
+
if (range.fullName === null || !requested.has(range.fullName)) continue;
|
|
3998
|
+
tokens.add(range.token);
|
|
3999
|
+
matched.add(range.fullName);
|
|
4000
|
+
}
|
|
4001
|
+
return {
|
|
4002
|
+
tokens,
|
|
4003
|
+
unreadableNames: ranges.filter(({ fullName }) => fullName === null).length,
|
|
4004
|
+
selection: {
|
|
4005
|
+
type_names: [...typeNames],
|
|
4006
|
+
unmatched_type_names: typeNames.filter((name) => !matched.has(name))
|
|
4007
|
+
}
|
|
4008
|
+
};
|
|
4009
|
+
};
|
|
4010
|
+
inspectManagedMembersBytes = (bytes, target, { typeNames, methodOffset = 0, methodLimit = Number.MAX_SAFE_INTEGER, userStrings: readUserStrings = true } = {}) => {
|
|
4011
|
+
if (!Number.isSafeInteger(methodOffset) || methodOffset < 0 || !Number.isSafeInteger(methodLimit) || methodLimit < 0) throw new RangeError("methodOffset and methodLimit must be non-negative safe integers");
|
|
4012
|
+
const pe = readManagedPeLayout(bytes);
|
|
4013
|
+
if (pe.cli === null) return unavailable(target, bytes, pe.cliIssue, typeNames);
|
|
4014
|
+
const issues = [];
|
|
4015
|
+
try {
|
|
4016
|
+
const { layout, inventory, memberLists } = readMemberInventory(bytes, pe, issues);
|
|
4017
|
+
appendManagedParseIssues(issues, inventory.issues);
|
|
4018
|
+
const ranges = typeRanges(bytes, layout, issues, memberLists);
|
|
4019
|
+
const { tokens: selected, selection, unreadableNames } = selectTypes(ranges, typeNames);
|
|
4020
|
+
const parsedTypes = parseTypes(bytes, layout, ranges);
|
|
4021
|
+
appendManagedParseIssues(issues, parsedTypes.issues);
|
|
4022
|
+
const exportedTypes = parseExportedTypes(bytes, layout);
|
|
4023
|
+
appendManagedParseIssues(issues, exportedTypes.issues);
|
|
4024
|
+
const fields = parseFields(bytes, layout, ranges, memberLists, selected);
|
|
4025
|
+
const memberRefs = parseMemberRefs(bytes, layout, typeNameLookup(bytes, layout, ranges, issues));
|
|
4026
|
+
appendManagedParseIssues(issues, memberRefs.issues);
|
|
4027
|
+
const methods = parseMethods({
|
|
4028
|
+
bytes,
|
|
4029
|
+
layout,
|
|
4030
|
+
pe,
|
|
4031
|
+
ranges,
|
|
4032
|
+
memberLists,
|
|
4033
|
+
selected,
|
|
4034
|
+
methodOffset,
|
|
4035
|
+
methodLimit
|
|
4036
|
+
});
|
|
4037
|
+
appendManagedParseIssues(issues, fields.issues, methods.issues);
|
|
4038
|
+
const userStrings = readUserStrings ? parseUserStrings(bytes, layout, {
|
|
4039
|
+
...methods,
|
|
4040
|
+
unreadableSelectedTypes: unreadableNames
|
|
4041
|
+
}) : null;
|
|
4042
|
+
const targets = edgeTargets(bytes, layout, methods.methods, [
|
|
4043
|
+
fields.core,
|
|
4044
|
+
memberRefs.core,
|
|
4045
|
+
methods.core
|
|
4046
|
+
]);
|
|
4047
|
+
appendManagedParseIssues(issues, targets.issues);
|
|
4048
|
+
const coverageIssues = uniqueManagedParseIssues(issues);
|
|
4049
|
+
const incompleteMembers = [
|
|
4050
|
+
...fields.fields,
|
|
4051
|
+
...memberRefs.refs,
|
|
4052
|
+
...methods.methods
|
|
4053
|
+
].some((member) => member.signature.parse_status !== "decoded") || methods.methods.some((method) => method.body.status === "partial" || method.body.status === "malformed");
|
|
4054
|
+
const related = edges(methods.methods, targets.members, managedDecodeBudget(layout));
|
|
4055
|
+
return managedMemberInspectionSchema.parse(admitManagedProjection({
|
|
4056
|
+
artifact: {
|
|
4057
|
+
path: target.path,
|
|
4058
|
+
sha256: target.sha256,
|
|
4059
|
+
byte_length: bytes.length,
|
|
4060
|
+
format: "pe"
|
|
4061
|
+
},
|
|
4062
|
+
module: inventory.module,
|
|
4063
|
+
metadata: {
|
|
4064
|
+
status: issues.length === 0 ? "complete" : "partial",
|
|
4065
|
+
version: layout.version,
|
|
4066
|
+
table_row_counts: managedTableRowCounts(layout)
|
|
4067
|
+
},
|
|
4068
|
+
identity_scope: {
|
|
4069
|
+
token_identity: "build-local",
|
|
4070
|
+
requires_artifact_sha256: target.sha256,
|
|
4071
|
+
requires_mvid: inventory.module?.mvid ?? null
|
|
4072
|
+
},
|
|
4073
|
+
types: selected === null ? parsedTypes.types : parsedTypes.types.filter((type) => selected.has(type.token)),
|
|
4074
|
+
exported_types: exportedTypes.exportedTypes,
|
|
4075
|
+
fields: fields.fields,
|
|
4076
|
+
methods: methods.methods,
|
|
4077
|
+
member_refs: memberRefs.refs,
|
|
4078
|
+
call_edges: related.callEdges,
|
|
4079
|
+
field_accesses: related.fieldAccesses,
|
|
4080
|
+
user_strings: userStrings,
|
|
4081
|
+
selection,
|
|
4082
|
+
coverage: {
|
|
4083
|
+
state: issues.length === 0 && !incompleteMembers ? "complete" : "partial",
|
|
4084
|
+
issues: coverageIssues
|
|
4085
|
+
},
|
|
4086
|
+
limitations: [
|
|
4087
|
+
"Metadata tokens are build-local coordinates and are only meaningful with the reported artifact SHA-256 and MVID.",
|
|
4088
|
+
"CIL instruction anchors are decoded from file-backed method bodies only; no target assembly is loaded or executed.",
|
|
4089
|
+
"Exported types are reported from ExportedType rows as declared; forwarded types are not resolved in their implementing assemblies.",
|
|
4090
|
+
"User strings are the #US literals loaded by ldstr in the inspected method bodies, with their own coverage; instruction anchors and normalized CIL digests keep their build-local tokens.",
|
|
4091
|
+
"Member signatures decode ECMA-335 primitive, class, valuetype, generic instantiation, generic variable, pointer, byref, single-dimension and general array, function pointer, custom modifier, and typed reference forms; class and valuetype operands keep their encoded TypeDefOrRefOrSpec values, and unsupported forms such as vararg sentinels retain raw signature hashes.",
|
|
4092
|
+
...selection === null ? [] : ["Types, fields, methods, call edges, field accesses, and user strings cover only the selected declaring types; coverage describes that selection. Edge targets outside it keep their names but are not described."],
|
|
4093
|
+
...unreadableNames === 0 ? [] : [`${String(unreadableNames)} TypeDef name(s) could not be read; a name in selection.unmatched_type_names may belong to one of them, so its absence is not observed.`]
|
|
4094
|
+
]
|
|
4095
|
+
}, managedDecodeBudget(layout)));
|
|
4096
|
+
} catch (cause) {
|
|
4097
|
+
if (cause instanceof ManagedReaderFailure) return unavailable(target, bytes, cause.issue, typeNames);
|
|
4098
|
+
throw cause;
|
|
4099
|
+
}
|
|
4100
|
+
};
|
|
4101
|
+
})))();
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
//#endregion
|
|
4105
|
+
//#region dist/dotnet/ManagedSnapshot.js
|
|
4106
|
+
var MAX_MANAGED_SNAPSHOT_BYTES, managedSnapshotCapacityError, readManagedSnapshot, hashManagedSource, readManagedFile, normalizeManagedReadFailure, managedCleanupError, normalizeReadFailure;
|
|
4107
|
+
function init_ManagedSnapshot() {
|
|
4108
|
+
return (init_ManagedSnapshot = __esmMin((() => {
|
|
4109
|
+
init_InvestigationProviders();
|
|
4110
|
+
init_BinaryTargetResolver();
|
|
4111
|
+
init_RegularFileRead();
|
|
4112
|
+
init_ArtifactReader();
|
|
4113
|
+
init_analysisErrorCleanup();
|
|
4114
|
+
init_analysisErrorBase();
|
|
4115
|
+
init_analysisErrorCore();
|
|
4116
|
+
init_evidenceErrors();
|
|
4117
|
+
init_providerCleanupError();
|
|
4118
|
+
init_RegularFile();
|
|
4119
|
+
init_BoundedFileBytes();
|
|
4120
|
+
MAX_MANAGED_SNAPSHOT_BYTES = 128 * 1024 * 1024;
|
|
4121
|
+
managedSnapshotCapacityError = (operation) => new AnalysisResourceConstraintError(operation, "memory", "Managed static inspection requires an eagerly retained PE snapshot within its input byte budget.", { max_snapshot_bytes: MAX_MANAGED_SNAPSHOT_BYTES });
|
|
4122
|
+
readManagedSnapshot = async (path, operation, options = {}) => {
|
|
4123
|
+
return readManagedFile(path, operation, async (handle, metadata) => {
|
|
4124
|
+
const signal = options.signal;
|
|
4125
|
+
if (metadata.size > 134217728) throw managedSnapshotCapacityError(operation);
|
|
4126
|
+
const bytes = await readBoundedFileBytes(handle, MAX_MANAGED_SNAPSHOT_BYTES, signal);
|
|
4127
|
+
if (bytes === undefined) throw managedSnapshotCapacityError(operation);
|
|
4128
|
+
signal?.throwIfAborted();
|
|
4129
|
+
return {
|
|
4130
|
+
byteLength: bytes.length,
|
|
4131
|
+
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
4132
|
+
bytes
|
|
4133
|
+
};
|
|
4134
|
+
}, options);
|
|
4135
|
+
};
|
|
4136
|
+
hashManagedSource = async (path, operation, options = {}) => readManagedFile(path, operation, async (handle, metadata) => {
|
|
4137
|
+
const signal = options.signal;
|
|
4138
|
+
if (metadata.size > 134217728) throw managedSnapshotCapacityError(operation);
|
|
4139
|
+
const digest = createHash("sha256");
|
|
4140
|
+
let byteLength = 0;
|
|
4141
|
+
const stream = handle.createReadStream({
|
|
4142
|
+
autoClose: false,
|
|
4143
|
+
...signal === undefined ? {} : { signal }
|
|
4144
|
+
});
|
|
4145
|
+
for await (const chunk of stream) {
|
|
4146
|
+
signal?.throwIfAborted();
|
|
4147
|
+
if (!Buffer.isBuffer(chunk)) throw new TypeError("Managed source stream returned non-buffer data");
|
|
4148
|
+
if (chunk.length > 134217728 - byteLength) throw managedSnapshotCapacityError(operation);
|
|
4149
|
+
byteLength += chunk.length;
|
|
4150
|
+
digest.update(chunk);
|
|
4151
|
+
}
|
|
4152
|
+
return {
|
|
4153
|
+
byteLength,
|
|
4154
|
+
sha256: digest.digest("hex")
|
|
4155
|
+
};
|
|
4156
|
+
}, options);
|
|
4157
|
+
readManagedFile = (path, operation, read, options) => withRegularFile(path, read, options).catch((cause) => {
|
|
4158
|
+
throw normalizeManagedReadFailure(cause, path, operation, options.signal);
|
|
4159
|
+
});
|
|
4160
|
+
normalizeManagedReadFailure = (cause, fallbackPath, operation, signal) => {
|
|
4161
|
+
const cleanupError = managedCleanupError(cause, fallbackPath, operation, signal);
|
|
4162
|
+
if (cleanupError !== undefined) return cleanupError;
|
|
4163
|
+
return normalizeReadFailure(cause, fallbackPath, operation, signal);
|
|
4164
|
+
};
|
|
4165
|
+
managedCleanupError = (cause, fallbackPath, operation, signal) => {
|
|
4166
|
+
if (cause instanceof RegularFileCleanupFailure) {
|
|
4167
|
+
const cleanup = new ProviderCleanupError(MANAGED_STATIC_PROVIDER.id, [cause.path], { reason: "A managed input file handle could not be closed" }, {
|
|
4168
|
+
cause,
|
|
4169
|
+
operation
|
|
4170
|
+
});
|
|
4171
|
+
const failure = cause.outcome.kind === "failed" ? normalizeReadFailure(cause.outcome.cause, cause.path, operation, signal) : undefined;
|
|
4172
|
+
return failure instanceof AnalysisError ? analysisErrorWithCleanupFailure(failure, cleanup, operation) : cleanup;
|
|
4173
|
+
}
|
|
4174
|
+
if (cause instanceof ArtifactReaderFailure && cause.cleanup !== undefined) return new ProviderCleanupError(MANAGED_STATIC_PROVIDER.id, cause.cleanup.resources.length > 0 ? cause.cleanup.resources : [fallbackPath], { reason: cause.cleanup.reason }, {
|
|
4175
|
+
cause,
|
|
4176
|
+
operation
|
|
4177
|
+
});
|
|
4178
|
+
return undefined;
|
|
4179
|
+
};
|
|
4180
|
+
normalizeReadFailure = (cause, path, operation, signal) => cause instanceof RegularFileChangedError ? new EvidenceIntegrityError(`Managed source changed while ${operation} was reading ${path}.`, { cause }) : cause instanceof AnalysisError ? cause : classifyBinaryTargetFilesystemFailure(path, cause) ?? (signal?.aborted === true ? new AnalysisCancelledError(operation, { cause }) : cause);
|
|
4181
|
+
})))();
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4184
|
+
//#endregion
|
|
4185
|
+
export { ManagedReaderFailure, admitManagedProjection, hashManagedSource, init_ManagedDecodeBudget, init_ManagedMemberInspector, init_ManagedMetadataHeaps, init_ManagedMetadataInventory, init_ManagedMetadataLayout, init_ManagedPeReader, init_ManagedReaderFailure, init_ManagedSnapshot, init_ManagedTypeMemberLists, inspectManagedMembersBytes, managedCleanupError, managedCli32BitRequirement, managedDecodeBudget, managedTableRowCounts, metadataCodedToken, metadataCodedTokenInvalidReason, metadataRowCursor, metadataToken, readManagedMetadataInventory, readManagedMetadataLayout, readManagedPeLayout, readManagedResourceDirectory, readManagedSnapshot, readManagedValue, readMetadataString, readTypeMemberListFacts };
|