Emurgo / cardano-serialization-lib

This is a library, written in Rust, for serialization & deserialization of data structures used in Cardano's Haskell implementation of Alonzo along with useful utility functions.
Other
230 stars 124 forks source link

Fix use after free #670

Open klntsky opened 3 months ago

klntsky commented 3 months ago

The value is moved and freed.

Repro:

const csl = await import ('@emurgo/cardano-serialization-lib-nodejs');

let body = csl.TransactionBody.new(
  csl.TransactionInputs.new(),
  csl.TransactionOutputs.new(),
  csl.BigNum.from_str('1')
);

let interval = csl.BigNum.one();
body.set_validity_start_interval_bignum(interval);
let witnessSet = csl.TransactionWitnessSet.new();
let tx = csl.Transaction.new(body, witnessSet);

setInterval(() => {
  console.log(interval.to_bytes());
} , 1000);