Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions fuzz/fuzz-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ export function fuzz(data) {
const text = data.toString('utf8')
const result = extractFrontmatter(text)

if (result == null || typeof result !== 'object') {
throw new Error(`extractFrontmatter returned ${JSON.stringify(result)}`)
}
// No explicit null/shape guard: extractFrontmatter returns an object
// literal on every path, so CodeQL correctly flags `result == null` as
// statically dead (js/comparison-between-incompatible-types). It also buys
// nothing — were it ever to return null, the property reads below throw a
// TypeError, which the fuzzer reports as a crash just the same.
if (typeof result.body !== 'string') {
throw new Error(`body is not a string: ${JSON.stringify(result.body)}`)
}
Expand Down
Loading