Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit d299d67

Browse files
committed
sixel_encoder_prepare_palette: kill use-after-free
The only place sixel_encoder_prepare_palette() is called from is sixel_encoder_encode_frame(). If we have a SIXEL_FAILED result inside the former, we unref the palette, potentially freeing it. We then goto the error path for sixel_encoder_encode_frame(), where we unref it again, in a classic double-free. Remove the internal unref. As noted, this is a single call site, so removing the unref can't cause a memory leak. Closes #27, reported by a4865g ("WuLearn").
1 parent fb32912 commit d299d67

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/encoder.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,6 @@ sixel_encoder_prepare_palette(
560560
encoder->method_for_rep,
561561
encoder->quality_mode);
562562
if (SIXEL_FAILED(status)) {
563-
sixel_dither_unref(*dither);
564563
goto end;
565564
}
566565

0 commit comments

Comments
 (0)