Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in StackTraceDeobfuscator for missing identifiers, plus incorrect methodNames from chromium #9996

Closed
niloc132 opened this issue Aug 28, 2024 · 0 comments · Fixed by #9997
Assignees
Milestone

Comments

@niloc132
Copy link
Member

GWT version: HEAD-SNAPSHOT
Browser (with version): any/chrome
Operating System: any

This issue is discussing two related issues, one a regression in GWT since #9936 and the other a regression in the past few years in chromium.

  • The GWT regression is mentioned at StackTraceDeobfuscator sometimes produces total nonsense #9931 (comment):

    So if the outer if is entered, there is a possibility that

     methodName = mappingForLine.getIdentifier().orElse(null);
    

    sets methodName to null.

    This results in an NPE while creating the replacement StackTraceElement, preventing reading the exception.

  • The Chromium issue is that when building a stack element of the form at method (file:row:col), the method name now may have a new prefix. This is not found in the symbol map file, so cannot be deobfuscated (though sourcemaps can try to take the row/col and figure out which file it should have come from). Example JS stack trace (with -style PRETTY):

    java.lang.RuntimeException: Runtime Exception
        at RuntimeException_0.createError (com.google.gwt.user.LoggingRPCSuite.JUnit-0.js:912:10)
        at RuntimeException_0.initializeBackingError (com.google.gwt.user.LoggingRPCSuite.JUnit-0.js:946:40)
        at RuntimeException_0.Throwable_0 (com.google.gwt.user.LoggingRPCSuite.JUnit-0.js:877:8)
        at RuntimeException_0.Exception_0 (com.google.gwt.user.LoggingRPCSuite.JUnit-0.js:961:15)
        at new RuntimeException_0 (com.google.gwt.user.LoggingRPCSuite.JUnit-0.js:970:15)
        at $throwException (com.google.gwt.user.LoggingRPCSuite.JUnit-0.js:4315:14)
        at LoggingRPCTest.testStackMapDeobfuscation (com.google.gwt.user.LoggingRPCSuite.JUnit-0.js:4369:5)
    

    Instead of new RuntimeException_0, our symbol maps expect RuntimeException_0, so this prefix needs to be removed.

@niloc132 niloc132 added this to the 2.12 milestone Aug 28, 2024
@niloc132 niloc132 self-assigned this Aug 28, 2024
niloc132 added a commit to niloc132/gwt that referenced this issue Aug 28, 2024
Improves accuracy of deobfuscated stack traces by using the best answer
between original JS names, symbol maps, and source maps, by both
avoiding taking an identifier from the sourcemap if none is provided,
and normalizing away chromium specific prefixes in stack trace elements.

Fixes gwtproject#9996
Follow-up gwtproject#9936
niloc132 added a commit to niloc132/gwt that referenced this issue Aug 28, 2024
Improves accuracy of deobfuscated stack traces by using the best answer
between original JS names, symbol maps, and source maps, by both
avoiding taking an identifier from the sourcemap if none is provided,
and normalizing away chromium specific prefixes in stack trace elements.

Fixes gwtproject#9996
Follow-up gwtproject#9936
niloc132 added a commit to niloc132/gwt that referenced this issue Aug 28, 2024
Improves accuracy of deobfuscated stack traces by using the best answer
between original JS names, symbol maps, and source maps, by both
avoiding taking an identifier from the sourcemap if none is provided,
and normalizing away chromium specific prefixes in stack trace elements.

Fixes gwtproject#9996
Follow-up gwtproject#9936
niloc132 added a commit that referenced this issue Sep 5, 2024
Improves accuracy of deobfuscated stack traces by using the best answer
between original JS names, symbol maps, and source maps, by both
avoiding taking an identifier from the sourcemap if none is provided,
and normalizing away chromium specific prefixes in stack trace elements.

Fixes #9996
Follow-up #9936
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant