diff --git a/flac.odin b/flac.odin index 13f5120..c7d1ea2 100644 --- a/flac.odin +++ b/flac.odin @@ -861,8 +861,9 @@ read_next_frame :: proc(r: ^Reader, flac: ^Flac, allocator := context.allocator) crc_buffer: Buffer // NOTE: using the default heap allocator here causes a use-after-free bug on files subset/05, subset/06, and subset/25 - // No idea what the cause of the bug is. - buffer_init_allocator(&crc_buffer, 0, 128, context.temp_allocator) + // No idea what the cause of the bug is. I am inclined to believe that it's a bug of the default heap allocator but + // maybe my code is fucking up the memory so bad it makes it seems that way. + buffer_init_allocator(&crc_buffer, 0, 128) crc := buffer_to_stream(&crc_buffer) r := &Reader{ diff --git a/internal.odin b/internal.odin index dce93ed..318be91 100644 --- a/internal.odin +++ b/internal.odin @@ -310,7 +310,7 @@ decode_extended_utf8 :: proc(r: ^Reader) -> (decoded_num: u64, err: Error) { return decoded_num, nil } -@(optimization_mode = "speed") +@(optimization_mode = "favor_size") calculate_crc8 :: proc(data: []byte) -> u8 #no_bounds_check { crc: u8 = 0 @@ -321,7 +321,7 @@ calculate_crc8 :: proc(data: []byte) -> u8 #no_bounds_check { return crc } -@(optimization_mode = "speed") +@(optimization_mode = "favor_size") calculate_crc16 :: proc(data: []byte) -> u16 #no_bounds_check { crc: u16 = 0