Skip to content

Commit c81bb88

Browse files
authored
fix(evm): fix CWE-1333 (#2573)
1 parent 701cd88 commit c81bb88

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changeset/hungry-steaks-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/sdk": patch
3+
---
4+
5+
fix CWE-1333

legacy_packages/sdk/src/evm/common/error.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,12 @@ export function parseRevertReason(error: any): string {
404404
errorString = error.toString();
405405
}
406406

407+
// if the error is just too long, just return the message to limit Regexp processing time
408+
// see: https://cwe.mitre.org/data/definitions/1333.html
409+
if (errorString.length > 5000) {
410+
return error.message || "";
411+
}
412+
407413
return (
408414
parseMessageParts(/.*?"message":"([^"\\]*).*?/, errorString) ||
409415
parseMessageParts(/.*?"reason":"([^"\\]*).*?/, errorString) ||

0 commit comments

Comments
 (0)