You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,I develop a Java app that call the sdk to verify signature.However,the app will crash when calling the sdk with some wrong inputs.
The error looks like:
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: InvalidInput, error: "y is not in field" }', zks-crypto-c/src/[utils.rs:228](http://utils.rs:228/):75
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
...
And I found that the sdk will unwrap the result and panic if the signature is wrong.
fn into_signature(signature: &[u8], params: &AltJubjubBn256) -> Signature<Engine> {
let r: Point<Engine, Unknown> = Point::read(&signature[..32], params).unwrap(); // the wrong signature will panic and crash the caller program
let mut s_repr = <Fs as PrimeField>::Repr::default();
s_repr.read_le(&signature[32..]).unwrap();
let s = Fs::from_repr(s_repr).unwrap();
Signature { r, s }
}
Could the sdk return an false instead of panic when calling the function 'verify_musig_rescue'?
The text was updated successfully, but these errors were encountered:
berryjam
changed the title
Could sdk use catch_unwind to catch panic instead of throwing it to caller program directly?
Could the sdk use catch_unwind to catch panic instead of throwing it to caller program directly?
Mar 13, 2024
Hi,I develop a Java app that call the sdk to verify signature.However,the app will crash when calling the sdk with some wrong inputs.
The error looks like:
And I found that the sdk will unwrap the result and panic if the signature is wrong.
Could the sdk return an false instead of panic when calling the function 'verify_musig_rescue'?
The text was updated successfully, but these errors were encountered: