Skip to content

Commit

Permalink
Handle non-message arguments in fallback script
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Nov 8, 2023
1 parent 4cb2d44 commit 61cb054
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion android/android-certificate-unpinning-fallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@ Java.perform(function () {
};

const buildUnhandledErrorPatcher = (errorClassName, originalConstructor) => {
return function (errorMessage) {
return function (errorArg) {
try {
console.log('\n !!! --- Unexpected TLS failure --- !!!');

// This may be a message, or an cause, or plausibly maybe other types? But
// stringifying gives something consistently message-shaped, so that'll do.
const errorMessage = errorArg?.toString() ?? '';

// Parse the stack trace to work out who threw this error:
const stackTrace = Java.use('java.lang.Thread').currentThread().getStackTrace();
const exceptionStackIndex = stackTrace.findIndex(stack =>
Expand Down

0 comments on commit 61cb054

Please sign in to comment.