Skip to content

Commit 9bc1608

Browse files
Limit float point values in extra headers to single precision
1 parent f178d05 commit 9bc1608

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- Add ms_nstime2timestr_n() with string size limit, deprecate ms_nstime2timestr().
33
- With ms_nstime2timestr_n() print "ERROR" for NSTERROR and "UNSET" for NSTUNSET.
44
- Avoid fatal errors when v2 record blockettes contain invalid time stamps.
5+
- Limit float point values in extra headers to single precision.
56
- Update yyjson to v0.12.0
67

78
2025.227:

extraheaders.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ mseh_add_recenter_r (MS3Record *msr, const char *ptr, MSEHRecenter *recenter,
996996
int
997997
mseh_serialize (MS3Record *msr, LM_PARSED_JSON **parsestate)
998998
{
999-
yyjson_write_flag flg = YYJSON_WRITE_NOFLAG;
999+
yyjson_write_flag flg;
10001000
yyjson_write_err err;
10011001
yyjson_alc alc = {_priv_malloc, _priv_realloc, _priv_free, NULL};
10021002

@@ -1012,6 +1012,10 @@ mseh_serialize (MS3Record *msr, LM_PARSED_JSON **parsestate)
10121012
if (!parsed || !parsed->mut_doc)
10131013
return 0;
10141014

1015+
/* Limit float point values to single precision to avoid unrealistically
1016+
* high precision values in the output. */
1017+
flg = YYJSON_WRITE_FP_TO_FLOAT;
1018+
10151019
/* Serialize new JSON string */
10161020
serialized = yyjson_mut_write_opts (parsed->mut_doc, flg, &alc, &serialsize, &err);
10171021

0 commit comments

Comments
 (0)