Skip to content

Commit

Permalink
enhance: make mapping by params initialization optional (android deob…
Browse files Browse the repository at this point in the history
…fuscation) (#823)

* Make parameter_mapping initialization (for android deobfuscation)
optional
  • Loading branch information
viglia authored Nov 30, 2023
1 parent b4f5af8 commit 7d9a66c
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 29 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## Unreleased

**Internal**

**Fixes**

**Features**

- Make mapping by params initialization optional ([#823](https://github.com/getsentry/symbolic/pull/823))

## 12.7.1

**Internal**
Expand Down
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions py/symbolic/proguard.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ class ProguardMapper(RustObject):
__dealloc_func__ = lib.symbolic_proguardmapper_free

@classmethod
def open(cls, path: str) -> ProguardMapper:
def open(cls, path: str, initialize_param_mapping: bool = False) -> ProguardMapper:
"""Constructs a mapping file from a path."""
return cls._from_objptr(
rustcall(lib.symbolic_proguardmapper_open, encode_path(path))
rustcall(
lib.symbolic_proguardmapper_open,
encode_path(path),
initialize_param_mapping,
)
)

@property
Expand Down
2 changes: 1 addition & 1 deletion symbolic-cabi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ publish = false
crate-type = ["cdylib"]

[dependencies]
proguard = { version = "5.3.0", features = ["uuid"] }
proguard = { version = "5.4.0", features = ["uuid"] }
sourcemap = "7.0.0"
symbolic = { version = "12.7.1", path = "../symbolic", features = ["cfi", "debuginfo", "sourcemapcache", "symcache"] }
tempfile = "3.4.0"
3 changes: 2 additions & 1 deletion symbolic-cabi/include/symbolic.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ struct SymbolicStr symbolic_normalize_debug_id(const struct SymbolicStr *debug_i
/**
* Creates a proguard mapping view from a path.
*/
struct SymbolicProguardMapper *symbolic_proguardmapper_open(const char *path);
struct SymbolicProguardMapper *symbolic_proguardmapper_open(const char *path,
bool initialize_param_mapping);

/**
* Frees a proguard mapping view.
Expand Down
9 changes: 7 additions & 2 deletions symbolic-cabi/src/proguard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,18 @@ impl ForeignObject for SymbolicProguardMapper {
ffi_fn! {
/// Creates a proguard mapping view from a path.
unsafe fn symbolic_proguardmapper_open(
path: *const c_char
path: *const c_char,
initialize_param_mapping: bool
) -> Result<*mut SymbolicProguardMapper> {
let byteview = ByteView::open(CStr::from_ptr(path).to_str()?)?;

let inner = SelfCell::new(byteview, |data| {
let mapping = ProguardMapping::new(&*data);
let mapper = ProguardMapper::new(mapping.clone());
let mapper = if !initialize_param_mapping {
ProguardMapper::new(mapping.clone())
} else {
ProguardMapper::new_with_param_mapping(mapping.clone(), initialize_param_mapping)
};
Inner { mapping, mapper }
});

Expand Down

0 comments on commit 7d9a66c

Please sign in to comment.