std/jpeg: fix default-quality workbuf length check

This commit is contained in:
Nigel Tao committed 2024-09-08 11:29:01 +10:00
1 parent affff51fbf
commit 53b3b0a9d0
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -993,10 +993,10 @@ pri func decoder.do_decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reade
// is long enough and setting this.swizzle_immediately.
this.swizzle_immediately = false
if this.components_workbuf_offsets[8] > args.workbuf.length() {
if this.sof_marker >= 0xC2 {
if (this.sof_marker >= 0xC2) or not this.use_lower_quality {
return base."#bad workbuf length"
}
this.swizzle_immediately = this.use_lower_quality
this.swizzle_immediately = true
this.swizzle_immediately_status = ok
} else if this.components_workbuf_offsets[4] < this.components_workbuf_offsets[8] {
args.workbuf[this.components_workbuf_offsets[4] .. this.components_workbuf_offsets[8]].bulk_memset!(byte_value: 0)