From 8d3271e586cdef790197effb3985c04f35827d00 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 6 Mar 2023 12:02:45 -0800 Subject: [PATCH] Revert "Limit the index to the fixed gas mixes" This reverts commit 328812e95bfe7c6c9d2a8d36c75144f05c7dc9dc. This turns out to cause fatal parse failures for the cases where the gas change refers to a manual or bailout gas. As noted by Jef in that commit, we should likely report those differently, but in the meantime, at least don't fail the download. See the original report at [1], and a (at this point still contentious) bigger change to gas switch reporting at [2]. This revert exists purely as a "make it at least work for now". Reported-by: Michael Keller Link: https://github.com/subsurface/libdc/pull/46#issuecomment-1438313959 [1] Link: https://github.com/subsurface/libdc/pull/44 [2] Signed-off-by: Linus Torvalds --- src/hw_ostc_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index 0b0904d..9782fd7 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -1049,8 +1049,8 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call return DC_STATUS_DATAFORMAT; } unsigned int idx = data[offset]; - if (idx < 1 || idx > parser->nfixed) { - ERROR(abstract->context, "Invalid gas mix (%u).", idx); + if (idx < 1 || idx > parser->ngasmixes) { + ERROR(abstract->context, "Invalid gas mix."); return DC_STATUS_DATAFORMAT; } idx--; /* Convert to a zero based index. */