std/jpeg: reject 2 (not 1, 3 or 4) components
diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c
index 288e948..1364331 100644
--- a/release/c/wuffs-unsupported-snapshot.c
+++ b/release/c/wuffs-unsupported-snapshot.c
@@ -8636,6 +8636,7 @@
extern const char wuffs_jpeg__error__missing_quantization_table[];
extern const char wuffs_jpeg__error__truncated_input[];
extern const char wuffs_jpeg__error__unsupported_arithmetic_coding[];
+extern const char wuffs_jpeg__error__unsupported_color_model[];
extern const char wuffs_jpeg__error__unsupported_fractional_sampling[];
extern const char wuffs_jpeg__error__unsupported_hierarchical_coding[];
extern const char wuffs_jpeg__error__unsupported_implicit_height[];
@@ -36596,6 +36597,7 @@
const char wuffs_jpeg__error__missing_quantization_table[] = "#jpeg: missing Quantization table";
const char wuffs_jpeg__error__truncated_input[] = "#jpeg: truncated input";
const char wuffs_jpeg__error__unsupported_arithmetic_coding[] = "#jpeg: unsupported arithmetic coding";
+const char wuffs_jpeg__error__unsupported_color_model[] = "#jpeg: unsupported color model";
const char wuffs_jpeg__error__unsupported_fractional_sampling[] = "#jpeg: unsupported fractional sampling";
const char wuffs_jpeg__error__unsupported_hierarchical_coding[] = "#jpeg: unsupported hierarchical coding";
const char wuffs_jpeg__error__unsupported_implicit_height[] = "#jpeg: unsupported implicit height";
@@ -38436,6 +38438,9 @@
if ((v_c == 0) || (v_c > 4)) {
status = wuffs_base__make_status(wuffs_jpeg__error__bad_sof_marker);
goto exit;
+ } else if (v_c == 2) {
+ status = wuffs_base__make_status(wuffs_jpeg__error__unsupported_color_model);
+ goto exit;
}
self->private_impl.f_num_components = ((uint32_t)(v_c));
if (self->private_impl.f_payload_length != (3 * self->private_impl.f_num_components)) {
diff --git a/std/jpeg/decode_jpeg.wuffs b/std/jpeg/decode_jpeg.wuffs
index 5a2715b..cdd26fd 100644
--- a/std/jpeg/decode_jpeg.wuffs
+++ b/std/jpeg/decode_jpeg.wuffs
@@ -23,6 +23,7 @@
pub status "#missing Quantization table"
pub status "#truncated input"
pub status "#unsupported arithmetic coding"
+pub status "#unsupported color model"
pub status "#unsupported fractional sampling"
pub status "#unsupported hierarchical coding"
pub status "#unsupported implicit height"
@@ -414,6 +415,8 @@
c = args.src.read_u8?()
if (c == 0) or (c > 4) {
return "#bad SOF marker"
+ } else if c == 2 {
+ return "#unsupported color model"
}
this.num_components = c as base.u32
if this.payload_length <> (3 * this.num_components) {