public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/dcm2niix] rawhide: Backport update of vendored cJSON from 1.7.12 to 1.7.19
@ 2026-11-01  7:41 Benjamin A. Beasley
  0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-11-01  7:41 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/dcm2niix
Branch : rawhide
Commit : d0c2322bddaa2023d02e6678e1ef069a83344a74
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date   : 2026-11-01T07:34:22+00:00
Stats  : +968/-3 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/dcm2niix/c/d0c2322bddaa2023d02e6678e1ef069a83344a74?branch=rawhide

Log:
Backport update of vendored cJSON from 1.7.12 to 1.7.19

---
diff --git a/0ef930011067c6238a5e41ace46a6d023b8fd6c3.patch b/0ef930011067c6238a5e41ace46a6d023b8fd6c3.patch
new file mode 100644
index 0000000..e29102a
--- /dev/null
+++ b/0ef930011067c6238a5e41ace46a6d023b8fd6c3.patch
@@ -0,0 +1,819 @@
+From 0ef930011067c6238a5e41ace46a6d023b8fd6c3 Mon Sep 17 00:00:00 2001
+From: neurolabusc <rorden@sc.edu>
+Date: Sat, 31 Oct 2026 12:19:18 -0400
+Subject: [PATCH] Update vendored cJSON 1.7.12 -> 1.7.19 (#1058)
+
+Keeps local snprintf patch. JSON/JNIfTI/MRS output differs only in
+last-digit float formatting (relative compare_double, upstream fix).
+---
+ console/cJSON.cpp | 298 +++++++++++++++++++++++++++++++++++++---------
+ console/cJSON.h   |  42 ++++---
+ 2 files changed, 270 insertions(+), 70 deletions(-)
+
+diff --git a/console/cJSON.cpp b/console/cJSON.cpp
+index 6540f1f7..faa39fe9 100644
+--- a/console/cJSON.cpp
++++ b/console/cJSON.cpp
+@@ -38,6 +38,7 @@
+ #endif
+ 
+ #include <ctype.h>
++#include <float.h>
+ #include <limits.h>
+ #include <math.h>
+ #include <stdio.h>
+@@ -68,6 +69,22 @@
+ #endif
+ #define false ((cJSON_bool)0)
+ 
++/* define isnan and isinf for ANSI C, if in C99 or above, isnan and isinf has been defined in math.h */
++#ifndef isinf
++#define isinf(d) (isnan((d - d)) && !isnan(d))
++#endif
++#ifndef isnan
++#define isnan(d) (d != d)
++#endif
++
++#ifndef NAN
++#ifdef _WIN32
++#define NAN sqrt(-1.0)
++#else
++#define NAN 0.0 / 0.0
++#endif
++#endif
++
+ typedef struct {
+ 	const unsigned char *json;
+ 	size_t position;
+@@ -88,8 +105,17 @@ cJSON_GetStringValue(const cJSON *const item) {
+ 	return item->valuestring;
+ }
+ 
++CJSON_PUBLIC(double)
++cJSON_GetNumberValue(const cJSON *const item) {
++	if (!cJSON_IsNumber(item)) {
++		return (double)NAN;
++	}
++
++	return item->valuedouble;
++}
++
+ /* This is a safeguard to prevent copy-pasters from using incompatible C and header files */
+-#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 12)
++#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 19)
+ #error cJSON.h and cJSON.c have different versions. Make sure that both have the same.
+ #endif
+ 
+@@ -214,9 +240,11 @@ cJSON_Delete(cJSON *item) {
+ 		}
+ 		if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL)) {
+ 			global_hooks.deallocate(item->valuestring);
++			item->valuestring = NULL;
+ 		}
+ 		if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) {
+ 			global_hooks.deallocate(item->string);
++			item->string = NULL;
+ 		}
+ 		global_hooks.deallocate(item);
+ 		item = next;
+@@ -254,9 +282,11 @@ typedef struct
+ static cJSON_bool parse_number(cJSON *const item, parse_buffer *const input_buffer) {
+ 	double number = 0;
+ 	unsigned char *after_end = NULL;
+-	unsigned char number_c_string[64];
++	unsigned char *number_c_string;
+ 	unsigned char decimal_point = get_decimal_point();
+ 	size_t i = 0;
++	size_t number_string_length = 0;
++	cJSON_bool has_decimal_point = false;
+ 
+ 	if ((input_buffer == NULL) || (input_buffer->content == NULL)) {
+ 		return false;
+@@ -265,7 +295,7 @@ static cJSON_bool parse_number(cJSON *const item, parse_buffer *const input_buff
+ 	/* copy the number into a temporary buffer and replace '.' with the decimal point
+ 	 * of the current locale (for strtod)
+ 	 * This also takes care of '\0' not necessarily being available for marking the end of the input */
+-	for (i = 0; (i < (sizeof(number_c_string) - 1)) && can_access_at_index(input_buffer, i); i++) {
++	for (i = 0; can_access_at_index(input_buffer, i); i++) {
+ 		switch (buffer_at_offset(input_buffer)[i]) {
+ 		case '0':
+ 		case '1':
+@@ -281,11 +311,12 @@ static cJSON_bool parse_number(cJSON *const item, parse_buffer *const input_buff
+ 		case '-':
+ 		case 'e':
+ 		case 'E':
+-			number_c_string[i] = buffer_at_offset(input_buffer)[i];
++			number_string_length++;
+ 			break;
+ 
+ 		case '.':
+-			number_c_string[i] = decimal_point;
++			number_string_length++;
++			has_decimal_point = true;
+ 			break;
+ 
+ 		default:
+@@ -293,10 +324,28 @@ static cJSON_bool parse_number(cJSON *const item, parse_buffer *const input_buff
+ 		}
+ 	}
+ loop_end:
+-	number_c_string[i] = '\0';
++	/* malloc for temporary buffer, add 1 for '\0' */
++	number_c_string = (unsigned char *)input_buffer->hooks.allocate(number_string_length + 1);
++	if (number_c_string == NULL) {
++		return false; /* allocation failure */
++	}
++
++	memcpy(number_c_string, buffer_at_offset(input_buffer), number_string_length);
++	number_c_string[number_string_length] = '\0';
++
++	if (has_decimal_point) {
++		for (i = 0; i < number_string_length; i++) {
++			if (number_c_string[i] == '.') {
++				/* replace '.' with the decimal point of the current locale (for strtod) */
++				number_c_string[i] = decimal_point;
++			}
++		}
++	}
+ 
+ 	number = strtod((const char *)number_c_string, (char **)&after_end);
+ 	if (number_c_string == after_end) {
++		/* free the temporary buffer */
++		input_buffer->hooks.deallocate(number_c_string);
+ 		return false; /* parse_error */
+ 	}
+ 
+@@ -314,6 +363,8 @@ static cJSON_bool parse_number(cJSON *const item, parse_buffer *const input_buff
+ 	item->type = cJSON_Number;
+ 
+ 	input_buffer->offset += (size_t)(after_end - number_c_string);
++	/* free the temporary buffer */
++	input_buffer->hooks.deallocate(number_c_string);
+ 	return true;
+ }
+ 
+@@ -331,6 +382,44 @@ cJSON_SetNumberHelper(cJSON *object, double number) {
+ 	return object->valuedouble = number;
+ }
+ 
++/* Note: when passing a NULL valuestring, cJSON_SetValuestring treats this as an error and return NULL */
++CJSON_PUBLIC(char *)
++cJSON_SetValuestring(cJSON *object, const char *valuestring) {
++	char *copy = NULL;
++	size_t v1_len;
++	size_t v2_len;
++	/* if object's type is not cJSON_String or is cJSON_IsReference, it should not set valuestring */
++	if ((object == NULL) || !(object->type & cJSON_String) || (object->type & cJSON_IsReference)) {
++		return NULL;
++	}
++	/* return NULL if the object is corrupted or valuestring is NULL */
++	if (object->valuestring == NULL || valuestring == NULL) {
++		return NULL;
++	}
++
++	v1_len = strlen(valuestring);
++	v2_len = strlen(object->valuestring);
++
++	if (v1_len <= v2_len) {
++		/* strcpy does not handle overlapping string: [X1, X2] [Y1, Y2] => X2 < Y1 or Y2 < X1 */
++		if (!(valuestring + v1_len < object->valuestring || object->valuestring + v2_len < valuestring)) {
++			return NULL;
++		}
++		strcpy(object->valuestring, valuestring);
++		return object->valuestring;
++	}
++	copy = (char *)cJSON_strdup((const unsigned char *)valuestring, &global_hooks);
++	if (copy == NULL) {
++		return NULL;
++	}
++	if (object->valuestring != NULL) {
++		cJSON_free(object->valuestring);
++	}
++	object->valuestring = copy;
++
++	return copy;
++}
++
+ typedef struct
+ {
+ 	unsigned char *buffer;
+@@ -402,9 +491,8 @@ static unsigned char *ensure(printbuffer *const p, size_t needed) {
+ 
+ 			return NULL;
+ 		}
+-		if (newbuffer) {
+-			memcpy(newbuffer, p->buffer, p->offset + 1);
+-		}
++
++		memcpy(newbuffer, p->buffer, p->offset + 1);
+ 		p->hooks.deallocate(p->buffer);
+ 	}
+ 	p->length = newsize;
+@@ -426,7 +514,8 @@ static void update_offset(printbuffer *const buffer) {
+ 
+ /* securely comparison of floating-point variables */
+ static cJSON_bool compare_double(double a, double b) {
+-	return (fabs(a - b) <= CJSON_DOUBLE_PRECISION);
++	double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b);
++	return (fabs(a - b) <= maxVal * DBL_EPSILON);
+ }
+ 
+ /* Render the number nicely from the given item into a string. */
+@@ -444,8 +533,10 @@ static cJSON_bool print_number(const cJSON *const item, printbuffer *const outpu
+ 	}
+ 
+ 	/* This checks for NaN and Infinity */
+-	if ((d * 0) != 0) {
++	if (isnan(d) || isinf(d)) {
+ 		length = snprintf((char *)number_buffer, sizeof(number_buffer), "null");
++	} else if (d == (double)item->valueint) {
++		length = snprintf((char *)number_buffer, sizeof(number_buffer), "%d", item->valueint);
+ 	} else {
+ 		/* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */
+ 		length = snprintf((char *)number_buffer, sizeof(number_buffer), "%1.15g", d);
+@@ -716,6 +807,7 @@ static cJSON_bool parse_string(cJSON *const item, parse_buffer *const input_buff
+ fail:
+ 	if (output != NULL) {
+ 		input_buffer->hooks.deallocate(output);
++		output = NULL;
+ 	}
+ 
+ 	if (input_pointer != NULL) {
+@@ -852,6 +944,10 @@ static parse_buffer *buffer_skip_whitespace(parse_buffer *const buffer) {
+ 		return NULL;
+ 	}
+ 
++	if (cannot_access_at_index(buffer, 0)) {
++		return buffer;
++	}
++
+ 	while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32)) {
+ 		buffer->offset++;
+ 	}
+@@ -876,9 +972,23 @@ static parse_buffer *skip_utf8_bom(parse_buffer *const buffer) {
+ 	return buffer;
+ }
+ 
+-/* Parse an object - create a new root, and populate. */
+ CJSON_PUBLIC(cJSON *)
+ cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) {
++	size_t buffer_length;
++
++	if (NULL == value) {
++		return NULL;
++	}
++
++	/* Adding null character size due to require_null_terminated. */
++	buffer_length = strlen(value) + sizeof("");
++
++	return cJSON_ParseWithLengthOpts(value, buffer_length, return_parse_end, require_null_terminated);
++}
++
++/* Parse an object - create a new root, and populate. */
++CJSON_PUBLIC(cJSON *)
++cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated) {
+ 	parse_buffer buffer = {0, 0, 0, 0, {0, 0, 0}};
+ 	cJSON *item = NULL;
+ 
+@@ -886,12 +996,12 @@ cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool
+ 	global_error.json = NULL;
+ 	global_error.position = 0;
+ 
+-	if (value == NULL) {
++	if (value == NULL || 0 == buffer_length) {
+ 		goto fail;
+ 	}
+ 
+ 	buffer.content = (const unsigned char *)value;
+-	buffer.length = strlen((const char *)value) + sizeof("");
++	buffer.length = buffer_length;
+ 	buffer.offset = 0;
+ 	buffer.hooks = global_hooks;
+ 
+@@ -951,7 +1061,12 @@ cJSON_Parse(const char *value) {
+ 	return cJSON_ParseWithOpts(value, 0, 0);
+ }
+ 
+-#define cjson_min(a, b) ((a < b) ? a : b)
++CJSON_PUBLIC(cJSON *)
++cJSON_ParseWithLength(const char *value, size_t buffer_length) {
++	return cJSON_ParseWithLengthOpts(value, buffer_length, 0, 0);
++}
++
++#define cjson_min(a, b) (((a) < (b)) ? (a) : (b))
+ 
+ static unsigned char *print(const cJSON *const item, cJSON_bool format, const internal_hooks *const hooks) {
+ 	static const size_t default_buffer_size = 256;
+@@ -993,6 +1108,7 @@ static unsigned char *print(const cJSON *const item, cJSON_bool format, const in
+ 
+ 		/* free the buffer */
+ 		hooks->deallocate(buffer->buffer);
++		buffer->buffer = NULL;
+ 	}
+ 
+ 	return printed;
+@@ -1000,10 +1116,12 @@ static unsigned char *print(const cJSON *const item, cJSON_bool format, const in
+ fail:
+ 	if (buffer->buffer != NULL) {
+ 		hooks->deallocate(buffer->buffer);
++		buffer->buffer = NULL;
+ 	}
+ 
+ 	if (printed != NULL) {
+ 		hooks->deallocate(printed);
++		printed = NULL;
+ 	}
+ 
+ 	return NULL;
+@@ -1041,6 +1159,7 @@ cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt) {
+ 
+ 	if (!print_value(item, &p)) {
+ 		global_hooks.deallocate(p.buffer);
++		p.buffer = NULL;
+ 		return NULL;
+ 	}
+ 
+@@ -1241,6 +1360,10 @@ static cJSON_bool parse_array(cJSON *const item, parse_buffer *const input_buffe
+ success:
+ 	input_buffer->depth--;
+ 
++	if (head != NULL) {
++		head->prev = current_item;
++	}
++
+ 	item->type = cJSON_Array;
+ 	item->child = head;
+ 
+@@ -1356,6 +1479,10 @@ static cJSON_bool parse_object(cJSON *const item, parse_buffer *const input_buff
+ 			current_item = new_item;
+ 		}
+ 
++		if (cannot_access_at_index(input_buffer, 1)) {
++			goto fail; /* nothing comes after the comma */
++		}
++
+ 		/* parse the name of the child */
+ 		input_buffer->offset++;
+ 		buffer_skip_whitespace(input_buffer);
+@@ -1388,6 +1515,10 @@ static cJSON_bool parse_object(cJSON *const item, parse_buffer *const input_buff
+ success:
+ 	input_buffer->depth--;
+ 
++	if (head != NULL) {
++		head->prev = current_item;
++	}
++
+ 	item->type = cJSON_Object;
+ 	item->child = head;
+ 
+@@ -1613,30 +1744,34 @@ static cJSON *create_reference(const cJSON *item, const internal_hooks *const ho
+ static cJSON_bool add_item_to_array(cJSON *array, cJSON *item) {
+ 	cJSON *child = NULL;
+ 
+-	if ((item == NULL) || (array == NULL)) {
++	if ((item == NULL) || (array == NULL) || (array == item)) {
+ 		return false;
+ 	}
+ 
+ 	child = array->child;
+-
++	/*
++	 * To find the last item in array quickly, we use prev in array
++	 */
+ 	if (child == NULL) {
+ 		/* list is empty, start new one */
+ 		array->child = item;
++		item->prev = item;
++		item->next = NULL;
+ 	} else {
+ 		/* append to the end */
+-		while (child->next) {
+-			child = child->next;
++		if (child->prev) {
++			suffix_object(child->prev, item);
++			array->child->prev = item;
+ 		}
+-		suffix_object(child, item);
+ 	}
+ 
+ 	return true;
+ }
+ 
+ /* Add item to array/object. */
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_AddItemToArray(cJSON *array, cJSON *item) {
+-	add_item_to_array(array, item);
++	return add_item_to_array(array, item);
+ }
+ 
+ #if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))))
+@@ -1657,7 +1792,7 @@ static cJSON_bool add_item_to_object(cJSON *const object, const char *const stri
+ 	char *new_key = NULL;
+ 	int new_type = cJSON_Invalid;
+ 
+-	if ((object == NULL) || (string == NULL) || (item == NULL)) {
++	if ((object == NULL) || (string == NULL) || (item == NULL) || (object == item)) {
+ 		return false;
+ 	}
+ 
+@@ -1683,33 +1818,33 @@ static cJSON_bool add_item_to_object(cJSON *const object, const char *const stri
+ 	return add_item_to_array(object, item);
+ }
+ 
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) {
+-	add_item_to_object(object, string, item, &global_hooks, false);
++	return add_item_to_object(object, string, item, &global_hooks, false);
+ }
+ 
+ /* Add an item to an object with constant string as key */
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) {
+-	add_item_to_object(object, string, item, &global_hooks, true);
++	return add_item_to_object(object, string, item, &global_hooks, true);
+ }
+ 
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) {
+ 	if (array == NULL) {
+-		return;
++		return false;
+ 	}
+ 
+-	add_item_to_array(array, create_reference(item, &global_hooks));
++	return add_item_to_array(array, create_reference(item, &global_hooks));
+ }
+ 
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) {
+ 	if ((object == NULL) || (string == NULL)) {
+-		return;
++		return false;
+ 	}
+ 
+-	add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false);
++	return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false);
+ }
+ 
+ CJSON_PUBLIC(cJSON *)
+@@ -1813,11 +1948,11 @@ cJSON_AddArrayToObject(cJSON *const object, const char *const name) {
+ 
+ CJSON_PUBLIC(cJSON *)
+ cJSON_DetachItemViaPointer(cJSON *parent, cJSON *const item) {
+-	if ((parent == NULL) || (item == NULL)) {
++	if ((parent == NULL) || (item == NULL) || (item != parent->child && item->prev == NULL)) {
+ 		return NULL;
+ 	}
+ 
+-	if (item->prev != NULL) {
++	if (item != parent->child) {
+ 		/* not the first element */
+ 		item->prev->next = item->next;
+ 	}
+@@ -1829,7 +1964,11 @@ cJSON_DetachItemViaPointer(cJSON *parent, cJSON *const item) {
+ 	if (item == parent->child) {
+ 		/* first element */
+ 		parent->child = item->next;
++	} else if (item->next == NULL) {
++		/* last element */
++		parent->child->prev = item->prev;
+ 	}
++
+ 	/* make sure the detached item doesn't point anywhere anymore */
+ 	item->prev = NULL;
+ 	item->next = NULL;
+@@ -1876,18 +2015,22 @@ cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string) {
+ }
+ 
+ /* Replace array/object items with new ones. */
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) {
+ 	cJSON *after_inserted = NULL;
+ 
+-	if (which < 0) {
+-		return;
++	if (which < 0 || newitem == NULL) {
++		return false;
+ 	}
+ 
+ 	after_inserted = get_array_item(array, (size_t)which);
+ 	if (after_inserted == NULL) {
+-		add_item_to_array(array, newitem);
+-		return;
++		return add_item_to_array(array, newitem);
++	}
++
++	if (after_inserted != array->child && after_inserted->prev == NULL) {
++		/* return false if after_inserted is a corrupted array item */
++		return false;
+ 	}
+ 
+ 	newitem->next = after_inserted;
+@@ -1898,11 +2041,12 @@ cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) {
+ 	} else {
+ 		newitem->prev->next = newitem;
+ 	}
++	return true;
+ }
+ 
+ CJSON_PUBLIC(cJSON_bool)
+ cJSON_ReplaceItemViaPointer(cJSON *const parent, cJSON *const item, cJSON *replacement) {
+-	if ((parent == NULL) || (replacement == NULL) || (item == NULL)) {
++	if ((parent == NULL) || (parent->child == NULL) || (replacement == NULL) || (item == NULL)) {
+ 		return false;
+ 	}
+ 
+@@ -1916,11 +2060,21 @@ cJSON_ReplaceItemViaPointer(cJSON *const parent, cJSON *const item, cJSON *repla
+ 	if (replacement->next != NULL) {
+ 		replacement->next->prev = replacement;
+ 	}
+-	if (replacement->prev != NULL) {
+-		replacement->prev->next = replacement;
+-	}
+ 	if (parent->child == item) {
++		if (parent->child->prev == parent->child) {
++			replacement->prev = replacement;
++		}
+ 		parent->child = replacement;
++	} else { /*
++			  * To find the last item in array quickly, we use prev in array.
++			  * We can't modify the last item's next pointer where this item was the parent's child
++			  */
++		if (replacement->prev != NULL) {
++			replacement->prev->next = replacement;
++		}
++		if (replacement->next == NULL) {
++			parent->child->prev = replacement;
++		}
+ 	}
+ 
+ 	item->next = NULL;
+@@ -1930,13 +2084,13 @@ cJSON_ReplaceItemViaPointer(cJSON *const parent, cJSON *const item, cJSON *repla
+ 	return true;
+ }
+ 
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) {
+ 	if (which < 0) {
+-		return;
++		return false;
+ 	}
+ 
+-	cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem);
++	return cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem);
+ }
+ 
+ static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) {
+@@ -1949,21 +2103,23 @@ static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSO
+ 		cJSON_free(replacement->string);
+ 	}
+ 	replacement->string = (char *)cJSON_strdup((const unsigned char *)string, &global_hooks);
+-	replacement->type &= ~cJSON_StringIsConst;
++	if (replacement->string == NULL) {
++		return false;
++	}
+ 
+-	cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement);
++	replacement->type &= ~cJSON_StringIsConst;
+ 
+-	return true;
++	return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement);
+ }
+ 
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) {
+-	replace_item_in_object(object, string, newitem, false);
++	return replace_item_in_object(object, string, newitem, false);
+ }
+ 
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) {
+-	replace_item_in_object(object, string, newitem, true);
++	return replace_item_in_object(object, string, newitem, true);
+ }
+ 
+ /* Create basic types: */
+@@ -2123,6 +2279,7 @@ cJSON_CreateIntArray(const int *numbers, int count) {
+ 	}
+ 
+ 	a = cJSON_CreateArray();
++
+ 	for (i = 0; a && (i < (size_t)count); i++) {
+ 		n = cJSON_CreateNumber(numbers[i]);
+ 		if (!n) {
+@@ -2137,6 +2294,10 @@ cJSON_CreateIntArray(const int *numbers, int count) {
+ 		p = n;
+ 	}
+ 
++	if (a && a->child) {
++		a->child->prev = n;
++	}
++
+ 	return a;
+ }
+ 
+@@ -2167,6 +2328,10 @@ cJSON_CreateFloatArray(const float *numbers, int count) {
+ 		p = n;
+ 	}
+ 
++	if (a && a->child) {
++		a->child->prev = n;
++	}
++
+ 	return a;
+ }
+ 
+@@ -2197,6 +2362,10 @@ cJSON_CreateDoubleArray(const double *numbers, int count) {
+ 		p = n;
+ 	}
+ 
++	if (a && a->child) {
++		a->child->prev = n;
++	}
++
+ 	return a;
+ }
+ 
+@@ -2227,12 +2396,22 @@ cJSON_CreateStringArray(const char *const *strings, int count) {
+ 		p = n;
+ 	}
+ 
++	if (a && a->child) {
++		a->child->prev = n;
++	}
++
+ 	return a;
+ }
+ 
+ /* Duplication */
++cJSON *cJSON_Duplicate_rec(const cJSON *item, size_t depth, cJSON_bool recurse);
++
+ CJSON_PUBLIC(cJSON *)
+ cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) {
++	return cJSON_Duplicate_rec(item, 0, recurse);
++}
++
++cJSON *cJSON_Duplicate_rec(const cJSON *item, size_t depth, cJSON_bool recurse) {
+ 	cJSON *newitem = NULL;
+ 	cJSON *child = NULL;
+ 	cJSON *next = NULL;
+@@ -2270,7 +2449,10 @@ cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) {
+ 	/* Walk the ->next chain for the child. */
+ 	child = item->child;
+ 	while (child != NULL) {
+-		newchild = cJSON_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */
++		if (depth >= CJSON_CIRCULAR_LIMIT) {
++			goto fail;
++		}
++		newchild = cJSON_Duplicate_rec(child, depth + 1, true); /* Duplicate (with recurse) each item in the ->next chain */
+ 		if (!newchild) {
+ 			goto fail;
+ 		}
+@@ -2286,6 +2468,9 @@ cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) {
+ 		}
+ 		child = child->next;
+ 	}
++	if (newitem && newitem->child) {
++		newitem->child->prev = newchild;
++	}
+ 
+ 	return newitem;
+ 
+@@ -2473,7 +2658,7 @@ cJSON_IsRaw(const cJSON *const item) {
+ 
+ CJSON_PUBLIC(cJSON_bool)
+ cJSON_Compare(const cJSON *const a, const cJSON *const b, const cJSON_bool case_sensitive) {
+-	if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_IsInvalid(a)) {
++	if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF))) {
+ 		return false;
+ 	}
+ 
+@@ -2587,4 +2772,5 @@ cJSON_malloc(size_t size) {
+ CJSON_PUBLIC(void)
+ cJSON_free(void *object) {
+ 	global_hooks.deallocate(object);
++	object = NULL;
+ }
+diff --git a/console/cJSON.h b/console/cJSON.h
+index 00b0f3fd..89ec31b7 100644
+--- a/console/cJSON.h
++++ b/console/cJSON.h
+@@ -80,7 +80,7 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ
+ /* project version */
+ #define CJSON_VERSION_MAJOR 1
+ #define CJSON_VERSION_MINOR 7
+-#define CJSON_VERSION_PATCH 12
++#define CJSON_VERSION_PATCH 19
+ 
+ #include <stddef.h>
+ 
+@@ -134,9 +134,10 @@ typedef int cJSON_bool;
+ #define CJSON_NESTING_LIMIT 1000
+ #endif
+ 
+-/* Precision of double variables comparison */
+-#ifndef CJSON_DOUBLE_PRECISION
+-#define CJSON_DOUBLE_PRECISION .0000000000000001
++/* Limits the length of circular references can be before cJSON rejects to parse them.
++ * This is to prevent stack overflows. */
++#ifndef CJSON_CIRCULAR_LIMIT
++#define CJSON_CIRCULAR_LIMIT 10000
+ #endif
+ 
+ /* returns the version of cJSON as a string */
+@@ -151,10 +152,14 @@ cJSON_InitHooks(cJSON_Hooks *hooks);
+ /* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
+ CJSON_PUBLIC(cJSON *)
+ cJSON_Parse(const char *value);
++CJSON_PUBLIC(cJSON *)
++cJSON_ParseWithLength(const char *value, size_t buffer_length);
+ /* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
+ /* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
+ CJSON_PUBLIC(cJSON *)
+ cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
++CJSON_PUBLIC(cJSON *)
++cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated);
+ 
+ /* Render a cJSON entity to text for transfer/storage. */
+ CJSON_PUBLIC(char *)
+@@ -190,9 +195,11 @@ cJSON_HasObjectItem(const cJSON *object, const char *string);
+ CJSON_PUBLIC(const char *)
+ cJSON_GetErrorPtr(void);
+ 
+-/* Check if the item is a string and return its valuestring */
++/* Check item type and return its value */
+ CJSON_PUBLIC(char *)
+ cJSON_GetStringValue(const cJSON *const item);
++CJSON_PUBLIC(double)
++cJSON_GetNumberValue(const cJSON *const item);
+ 
+ /* These functions check the type of an item */
+ CJSON_PUBLIC(cJSON_bool)
+@@ -260,19 +267,19 @@ CJSON_PUBLIC(cJSON *)
+ cJSON_CreateStringArray(const char *const *strings, int count);
+ 
+ /* Append item to the specified array/object. */
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_AddItemToArray(cJSON *array, cJSON *item);
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
+ /* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
+  * WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
+  * writing to `item->string` */
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
+ /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
+ 
+ /* Remove/Detach items from Arrays/Objects. */
+@@ -292,15 +299,15 @@ CJSON_PUBLIC(void)
+ cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
+ 
+ /* Update array items. */
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
+ CJSON_PUBLIC(cJSON_bool)
+ cJSON_ReplaceItemViaPointer(cJSON *const parent, cJSON *const item, cJSON *replacement);
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem);
+-CJSON_PUBLIC(void)
++CJSON_PUBLIC(cJSON_bool)
+ cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem);
+ 
+ /* Duplicate a cJSON item */
+@@ -347,6 +354,13 @@ cJSON_AddArrayToObject(cJSON *const object, const char *const name);
+ CJSON_PUBLIC(double)
+ cJSON_SetNumberHelper(cJSON *object, double number);
+ #define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
++/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */
++CJSON_PUBLIC(char *)
++cJSON_SetValuestring(cJSON *object, const char *valuestring);
++
++/* If the object is not a boolean type this does nothing and returns cJSON_Invalid else it returns the new type*/
++#define cJSON_SetBoolValue(object, boolValue) ( \
++	(object != NULL && ((object)->type & (cJSON_False | cJSON_True))) ? (object)->type = ((object)->type & (~(cJSON_False | cJSON_True))) | ((boolValue) ? cJSON_True : cJSON_False) : cJSON_Invalid)
+ 
+ /* Macro for iterating over an array or object */
+ #define cJSON_ArrayForEach(element, array) for (element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)

diff --git a/dcm2niix.spec b/dcm2niix.spec
index 30bc07b..e5b0afe 100644
--- a/dcm2niix.spec
+++ b/dcm2niix.spec
@@ -89,6 +89,34 @@ URL:            https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage
 %global forgeurl https://github.com/rordenlab/dcm2niix
 Source:         %{forgeurl}/archive/v%{version}/dcm2niix-%{version}.tar.gz
 
+# Together, the following two patches address:
+# Please consider updating the vendored cJSON library to 1.7.19
+# https://github.com/rordenlab/dcm2niix/issues/1058
+#
+# From that issue,
+#
+#   Thanks, the latest commit updates cJSON to 1.7.19 (retaining our local
+#   sprintf→snprintf patch). dcm2niix was not exposed: it only builds and
+#   prints JSON and never parses JSON with cJSON, so the parser and cJSON_Utils
+#   CVEs are unreachable. Still, the update should spare packagers from
+#   triaging future CVE reports against the bundled copy.
+#
+# Update vendored cJSON 1.7.12 -> 1.7.19 (#1058)
+#
+# Keeps local snprintf patch. JSON/JNIfTI/MRS output differs only in
+# last-digit float formatting (relative compare_double, upstream fix).
+#
+# https://github.com/rordenlab/dcm2niix/commit/0ef930011067c6238a5e41ace46a6d023b8fd6c3
+Patch:          %{forgeurl}/commit/0ef930011067c6238a5e41ace46a6d023b8fd6c3.patch
+# JNIfTI writer fails closed; cJSON audit follow-ups (#1058)
+#
+# nii_savejnii frees root/compressed on error paths, checks write/close
+# and removes partial output. Drop stale cJSON 'return void' comment;
+# document cJSON bump procedure and -m y Study Time jitter.
+#
+# https://github.com/rordenlab/dcm2niix/commit/e08127d03af9c3590d42c3defc2250ba9b1046e7
+Patch:          %{forgeurl}/commit/e08127d03af9c3590d42c3defc2250ba9b1046e7.patch
+
 # https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
 ExcludeArch:    %{ix86}
 
@@ -157,9 +185,11 @@ Provides:       bundled(niftilib) = 1.0.0
 # “With regards to the cJSON you can always build with it off, at least until
 # this promising format gains traction.”
 #
-# Please consider updating the vendored cJSON library to 1.7.19
-# https://github.com/rordenlab/dcm2niix/issues/1058
-Provides:       bundled(cJSON) = 1.7.12
+# Note also that there is a local sprintf→snprintf patch, and that (per
+# https://github.com/rordenlab/dcm2niix/issues/1058#issuecomment-6546536100)
+# dcm2niix only builds and prints JSON and never parses JSON with cJSON. This
+# limits the classes of cJSON bugs to which dcm2niix could be exposed.
+Provides:       bundled(cJSON) = 1.7.19
 %endif
 # console/base64.{h,cpp}
 #

diff --git a/e08127d03af9c3590d42c3defc2250ba9b1046e7.patch b/e08127d03af9c3590d42c3defc2250ba9b1046e7.patch
new file mode 100644
index 0000000..b5764a7
--- /dev/null
+++ b/e08127d03af9c3590d42c3defc2250ba9b1046e7.patch
@@ -0,0 +1,116 @@
+From e08127d03af9c3590d42c3defc2250ba9b1046e7 Mon Sep 17 00:00:00 2001
+From: neurolabusc <rorden@sc.edu>
+Date: Sat, 31 Oct 2026 12:52:28 -0400
+Subject: [PATCH] JNIfTI writer fails closed; cJSON audit follow-ups (#1058)
+
+nii_savejnii frees root/compressed on error paths, checks write/close
+and removes partial output. Drop stale cJSON 'return void' comment;
+document cJSON bump procedure and -m y Study Time jitter.
+---
+ console/makefile            |  2 +-
+ console/nii_dicom_batch.cpp | 31 +++++++++++++++----------------
+ docs/BUILD.md               |  2 ++
+ docs/PARSER_GOTCHAS.md      |  2 ++
+ 4 files changed, 20 insertions(+), 17 deletions(-)
+
+diff --git a/console/makefile b/console/makefile
+index de3e2298..ca3ad814 100644
+--- a/console/makefile
++++ b/console/makefile
+@@ -17,7 +17,7 @@ LFLAGS=
+ 
+ #Leak tests:
+ # https://clang.llvm.org/docs/AddressSanitizer.html
+-# clang++ -O1 -g -fsanitize=address -fno-omit-frame-pointer -I.  main_console.cpp nii_foreign.cpp nii_dicom.cpp jpg_0XC3.cpp ujpeg.cpp nifti1_io_core.cpp nii_ortho.cpp nii_dicom_batch.cpp base64.c cJSON.c -o dcm2niix -DmyDisableOpenJPEG
++# clang++ -O1 -g -fsanitize=address -fno-omit-frame-pointer -I.  main_console.cpp nii_foreign.cpp nii_dicom.cpp jpg_0XC3.cpp ujpeg.cpp nifti1_io_core.cpp nii_ortho.cpp nii_dicom_batch.cpp base64.c cJSON.cpp -o dcm2niix -DmyDisableOpenJPEG
+ 
+ #run "ZLIB=1 make" for ZLIB build
+ ifeq "$(ZLIB)" "1"
+diff --git a/console/nii_dicom_batch.cpp b/console/nii_dicom_batch.cpp
+index ab624044..3fb768b8 100644
+--- a/console/nii_dicom_batch.cpp
++++ b/console/nii_dicom_batch.cpp
+@@ -7146,6 +7146,8 @@ int nii_savejnii(char *niiFilename, struct nifti_1_header hdr, unsigned char *im
+ 			cJSON_AddStringToObject(dat, "_ArrayZipData_", (const char *)buf);
+ 		} else {
+ 			printError("Failed to compress data stream, error code=%d, status code=%d\n", ret, status);
++			free(compressed);
++			cJSON_Delete(root);
+ 			return EXIT_FAILURE;
+ 		}
+ 		if (compressed)
+@@ -7167,6 +7169,7 @@ int nii_savejnii(char *niiFilename, struct nifti_1_header hdr, unsigned char *im
+ 
+ 	/* now save JSON to file */
+ 	jsonstr = cJSON_Print(root);
++	cJSON_Delete(root);
+ 	if (jsonstr == NULL) {
+ 		printMessage("Error: error when converting to JNIfTI\n");
+ 		return EXIT_FAILURE;
+@@ -7175,15 +7178,17 @@ int nii_savejnii(char *niiFilename, struct nifti_1_header hdr, unsigned char *im
+ 	fp = fopen(fname, "wt");
+ 	if (fp == NULL) {
+ 		printMessage("Error: error when writing to JNIfTI file\n");
++		free(jsonstr);
++		return EXIT_FAILURE;
++	}
++	bool isWriteOK = (fprintf(fp, "%s\n", jsonstr) >= 0);
++	isWriteOK = (fclose(fp) == 0) && isWriteOK;
++	free(jsonstr);
++	if (!isWriteOK) {
++		printMessage("Error: error when writing to JNIfTI file\n");
++		remove(fname);
+ 		return EXIT_FAILURE;
+ 	}
+-	fprintf(fp, "%s\n", jsonstr);
+-	fclose(fp);
+-
+-	if (jsonstr)
+-		free(jsonstr);
+-	if (root)
+-		cJSON_Delete(root);
+ 	return EXIT_SUCCESS;
+ } // nii_savejnii()
+ #endif // #ifdef myEnableJNIFTI
+@@ -10717,15 +10722,9 @@ static bool xaPhysioWriteStreamFiles(const char *baseName, const char *label,
+ 	cJSON_AddItemToObject(root, "StartTime", startT);
+ 	if (cmrrMeasurementUuid != NULL)
+ 		cJSON_AddStringToObject(root, kCMRRMeasurementUuidJsonKey, cmrrMeasurementUuid);
+-	// The bundled cJSON's public cJSON_AddItemTo{Array,Object} return void, but
+-	// the private add_item_to_object can still fail (key strdup OOM) — silently
+-	// dropping a BIDS-required key while cJSON_Print happily serializes the
+-	// short object as "success". Verify every attach landed (expected column
+-	// count + all three object keys present) before trusting the sidecar; fail
+-	// closed otherwise, matching the cycle-3 physio fail-closed contract. (A
+-	// sub-strdup OOM here also orphans the dropped item; on this already-doomed
+-	// allocator-failure path the one-shot leak is acceptable versus the bug
+-	// risk of manual orphan tracking against a void-returning vendored API.)
++	// An attach can fail (key strdup OOM), silently dropping a BIDS-required key;
++	// verify every attach landed and fail closed (physio contract). The dropped
++	// item leaks on this already-failing OOM path.
+ 	int expectCols = 1 + ((trigName != NULL) ? 1 : 0) + ((peakName != NULL) ? 1 : 0);
+ 	if ((cJSON_GetArraySize(cols) != expectCols) ||
+ 		(cJSON_GetObjectItem(root, "PhysioType") == NULL) ||
+diff --git a/docs/BUILD.md b/docs/BUILD.md
+index 00c7a170..61a02958 100644
+--- a/docs/BUILD.md
++++ b/docs/BUILD.md
+@@ -32,3 +32,5 @@ Pre-push minimum includes `dcm_qa` plus `git ls-files | xargs codespell`. C/C++
+ ## Packaging Gotchas
+ 
+ Repo-controlled release channels are PyPI `pyproject.toml`, GitHub release `.appveyor.yml`, CI `.github/workflows/build.yml`, and `Dockerfile`. conda-forge and NeuroDebian are external feedstocks. zlib-ng is pinned at `2.3.3` with `ZLIB_COMPAT=ON`; OpenJPEG is pinned at `2.5.3`. Windows stack overflow (0xC00000FD) is silent: no stderr, no output. The reserve is fixed at link time, so every Windows build path (CMake MSVC/MinGW, `windows.bat`, COMPILE.md `cl`) must carry the 32 MB `/STACK`/`--stack` (issue 1040).
++
++Vendored cJSON (`console/cJSON.{cpp,h}`) is upstream 1.7.19 plus a local `sprintf`->`snprintf` patch; on bump re-apply it and diff JNIfTI, MRS ecode 44, physio and `-n -2` JSON (1.7.19 changed last-digit float output). dcm2niix never calls `cJSON_Parse`.
+diff --git a/docs/PARSER_GOTCHAS.md b/docs/PARSER_GOTCHAS.md
+index d32236a3..8dd77bcd 100644
+--- a/docs/PARSER_GOTCHAS.md
++++ b/docs/PARSER_GOTCHAS.md
+@@ -18,6 +18,8 @@ Philips Dixon (issue 1038): Water/Fat/In/Out-of-phase all report `ComplexImageCo
+ 
+ Parametric Map (issue 1041, SOP `1.2.840.10008.5.1.4.1.1.30`): channels share positions and differ only by per-frame `RealWorldValueMappingSequence` `LUTLabel` (0040,9210). The frame is `pmFrame-1`, counted from `FrameContentSequence` (0020,9111), which precedes the mapping; do not key on `nSliceMM`, which skips frame 0 when IOP is per-frame. A shared-group label (`pmFrame == 0`), empty labels, and second mappings per frame are ignored. Channel and `TemporalPositionIndex` go to `TDCMdim.pmChannel`/`pmTime`, never straight into `dimIdx` (the Philips `isKludgeIssue809` rewrite owns `dimIdx[6..7]`; reading slot 7 as a channel split non-PM R11+ dynamics per volume and overflowed `pmLabel`). Only a committed split copies them into `dimIdx[7]`/`[6]` (assumed unused) for a channel-then-time sort and sets the shape from counts, `xyzDim[4] = nPMChannel * nTime` (TPI range) and `xyzDim[3] = frames / xyzDim[4]`, never from the pre-derived `xyzDim`: the stack-position, temporal, and segment heuristics above may already have split it (dividing again turned slices into volumes). Temporal maps give one 4D file per channel. The split requires: no `isKludgeIssue809`, uncompressed pixels (historical: compressed multi-frame ignored frame order, now fixed; relax once compressed PM fixtures exist), a `FrameContentSequence` per frame, exactly `nSlice` frames in every (channel, TPI) cell (`nCell`; catches unlabeled frames, TPI gaps, uneven channels or times, and labels merged by 16-char truncation), `nSlice == maxInStackPositionNumber` when stacks are present (several stacks stay unsplit), channels <= `kMaxPMChannel-1` (15), frames divisible by `nPMChannel * nTime`, and frames that will be sorted (`numDimensionIndexValues == numberOfFrames`). Otherwise `pmChannel` is zeroed and the file stays unsplit and unlabeled, as before. Implicit VR descends into (0040,9096) only when `isParametricMap` (a gate next to the `isSQ()` calls, deliberately not the shared allowlist, so Philips implicit-VR RWV slope/intercept parsing is unchanged); otherwise the label is never reached. `pmChannel` splits volumes like `dixonType` (`gradDynVol` tie test, `isScaleOrTEVaries`) and `nii_readParRec` must zero it. The label is the filename postfix (dropped by `--terse`, `%h`/`%H`, `%O`; not in the sidecar). highdicom's nested `ContributingEquipmentSequence` Manufacturer "Highdicom…" matches `HI` → Hitachi when the top-level vendor is unknown; Hitachi is outside the allow-list that stores per-frame `dcmDim` records, so these files take the issue 372 position-rank fallback, which never fills `dcmDim` TE/scale fields, so entries must be zeroed (`initTDCMdim`, on demand: a per-file `calloc` of all `kMaxSlice2D` entries slowed WASM 50%). Both paths must work. Regression: `dcm_qa_parametermap`.
+ 
++`-m y` merges 2D slices whose Study Time (0008,0030) jitters within a series (TCIA Pancreas-CT anonymization) only when both Study and Series Instance UIDs match (`isSameSet`); otherwise differing Study Time splits the series.
++
+ ## Compression / Encapsulation
+ 
+ `kCompressJP2K` is the JPEG2000 transfer syntax marker, not the runtime decode toggle; `compressFlag` is the runtime decode toggle; RLE is `kCompressRLE`. JPEG lossless C3 with multi-item offset table bypasses the generic `dti4D->offsetTable[]` loop. Multi-fragment single-frame encapsulation uses `reassembleEncapsulatedFragments()` and is admitted only when `numberOfFrames <= 1`.

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-01  7:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01  7:41 [rpms/dcm2niix] rawhide: Backport update of vendored cJSON from 1.7.12 to 1.7.19 Benjamin A. Beasley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox