diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dd29957b..0f0e01ebd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Unreleased + +**Fixes** + +- sourcemapcache: Tokens are now considered to only extend to the end of the line + (as intended). This means that some lookups that would previously (incorrectly) + have returned unminified source positions now return nothing. ([#932](https://github.com/getsentry/symbolic/pull/932)) + ## 12.16.1 **Fixes** diff --git a/symbolic-sourcemapcache/src/lookup.rs b/symbolic-sourcemapcache/src/lookup.rs index abe549fdd..bfba5c686 100644 --- a/symbolic-sourcemapcache/src/lookup.rs +++ b/symbolic-sourcemapcache/src/lookup.rs @@ -177,6 +177,13 @@ impl<'data> SourceMapCache<'data> { Err(idx) => idx - 1, }; + // If the token has a lower minified line number, + // it actually belongs to the previous line. That means it should + // not match. + if self.min_source_positions.get(idx)?.line < sp.line { + return None; + } + let sl = self.orig_source_locations.get(idx)?; // If file, line, and column are all absent (== `u32::MAX`), this location is simply unmapped. diff --git a/symbolic-sourcemapcache/tests/integration.rs b/symbolic-sourcemapcache/tests/integration.rs index 0b1439cf1..9f53cea1b 100644 --- a/symbolic-sourcemapcache/tests/integration.rs +++ b/symbolic-sourcemapcache/tests/integration.rs @@ -38,6 +38,9 @@ fn resolves_inlined_function() { assert_eq!(sl.line(), 1); assert_eq!(sl.column(), 8); assert_eq!(sl.scope(), ScopeLookupResult::AnonymousScope); + + // There are no mappings for line 1 in the sourcemap. + assert!(cache.lookup(SourcePosition::new(1, 17)).is_none()); } #[test]