mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add timeout for Macho Parsers
This commit is contained in:
parent
e5c22e0298
commit
fcb36548de
1 changed files with 7 additions and 0 deletions
|
|
@ -102,6 +102,10 @@ export async function extractMachoMeta ({ machoFileInstance, FileApi = null }) {
|
|||
// Run through each parser
|
||||
for ( const Parser of parsers ) {
|
||||
try {
|
||||
const parserTimeout = setTimeout(() => {
|
||||
throw new Error( 'Timed out' )
|
||||
}, 60 * 1000 )
|
||||
|
||||
// Run the parser
|
||||
const parserInstance = new Parser({
|
||||
machoFileInstance,
|
||||
|
|
@ -109,6 +113,9 @@ export async function extractMachoMeta ({ machoFileInstance, FileApi = null }) {
|
|||
})
|
||||
const meta = await parserInstance.run()
|
||||
|
||||
// Clear the timeout
|
||||
clearTimeout( parserTimeout )
|
||||
|
||||
return meta
|
||||
} catch ( err ) {
|
||||
console.log( 'Macho parser failed', Parser )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue