Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ignore-scripts=true
ignore-scripts=false
package-lock=false
18 changes: 18 additions & 0 deletions benchmarks/fuzzer-check-errors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { FuzzedDataProvider } = require('@jazzer.js/core')
const fastContentTypeParse = require('../index.js')

function fuzz (data) {
const provider = new FuzzedDataProvider(data)

const fmtString = provider.consumeRemainingAsString()
try {
fastContentTypeParse.parse(fmtString)
} catch (error) {
// Ignore all expected errors
if (!(error instanceof TypeError)) {
throw error
}
}
}

module.exports = { fuzz }
12 changes: 12 additions & 0 deletions benchmarks/fuzzer-check-performance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { FuzzedDataProvider } = require('@jazzer.js/core')
const fastContentTypeParse = require('../index.js')

function fuzz (data) {
const provider = new FuzzedDataProvider(data)

const fmtString = provider.consumeRemainingAsString()
// Ignore errors; we're interested in performance slowdown
fastContentTypeParse.safeParse(fmtString)
}

module.exports = { fuzz }
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"lint:fix": "eslint --fix",
"test": "npm run test:unit && npm run test:typescript",
"test:typescript": "tsd",
"jazzer:errors": "jazzer benchmarks/fuzzer-check-errors --sync --timeout=100 -- -max_total_time=120",
"jazzer:performance": "jazzer benchmarks/fuzzer-check-performance --sync --timeout=100 -- -max_total_time=120",
Comment on lines +14 to +15
Copy link
Member

@Fdawgs Fdawgs Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eomm Maybe slap npm rebuild @jazzer.js/core onto the beginning of these so we don't need to allow scripts?

"test:unit": "c8 --100 node --test"
},
"keywords": [
Expand Down Expand Up @@ -58,6 +60,7 @@
}
],
"devDependencies": {
"@jazzer.js/core": "^2.1.0",
"benchmark": "^2.1.4",
"busboy": "^1.6.0",
"c8": "^10.1.3",
Expand Down
Loading