1
Fork 0

Try adding metadata length prefix, and obey it while decoding

This commit is contained in:
Rune Tynan 2023-02-13 12:50:45 -05:00
parent 267cd1d2c5
commit dce3947110
No known key found for this signature in database
GPG key ID: 7ECC932F8B2C731E
3 changed files with 10 additions and 2 deletions

View file

@ -305,6 +305,7 @@ pub fn create_compressed_metadata_file(
symbol_name: &str,
) -> Vec<u8> {
let mut compressed = rustc_metadata::METADATA_HEADER.to_vec();
compressed.write_all(&(metadata.raw_data().len() as u32).to_be_bytes()).unwrap();
FrameEncoder::new(&mut compressed).write_all(metadata.raw_data()).unwrap();
let Some(mut file) = create_object_file(sess) else {
return compressed.to_vec();