Fix paste ownership, input bounds, and IPC validation

Supersedes #5745, #5746, and #5747.
This commit is contained in:
Jinwoo Hong
2026-06-19 17:14:55 -07:00
committed by GitHub
parent a5920b2183
commit 972078f2c4
592 changed files with 33301 additions and 3735 deletions
+3 -2
View File
@@ -2,6 +2,7 @@ import { readBlobAtOid, type GitBufferExec, type GitExec } from './git-handler-o
import { parseBranchDiff } from './git-handler-utils'
import { buildDiffResult } from './git-diff-result'
import { parseNumstat } from '../shared/git-uncommitted-line-stats'
import { parseGitRevListFirstParentOid } from '../shared/git-rev-list-output'
const FULL_GIT_OBJECT_ID_PATTERN = /^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/
@@ -49,8 +50,8 @@ export async function commitCompare(git: GitExec, worktreePath: string, commitId
['rev-list', '--parents', '-n', '1', commitOid],
worktreePath
)
const [, firstParent] = parentsOut.trim().split(/\s+/)
summary.parentOid = firstParent ?? null
const firstParent = parseGitRevListFirstParentOid(parentsOut)
summary.parentOid = firstParent
summary.baseRef = firstParent ? firstParent.slice(0, 7) : 'empty tree'
// Why: root commits have no parent tree; diff-tree --root asks git to