open5gs/lib/sbi/support
Sukchan Lee d16c9e5d6d sbi: Fix NULL list-add abort on map values of type DateTime/array
OpenAPI_nf_profile_parseFromJSON() aborts via ogs_assert(data) in
listEntry_create() when an NFProfile carries a non-empty
nfSetRecoveryTimeList / serviceSetRecoveryTimeList. OSS-Fuzz:

  listEntry_create: Assertion `data' failed (lib/sbi/openapi/src/list.c:10)
  OpenAPI_list_add (list.c:116)
  OpenAPI_nf_profile_parseFromJSON (nf_profile.c:3989)

Root cause is in the model-body.mustache map handler. The per-value
type dispatch only emits assignments to localMapKeyPair for
isString / isByteArray / isNumeric / isBoolean. For a map whose value
is a DateTime (map<string,DateTime>, e.g. NfSetRecoveryTimeList) or an
array (map<string,array<string>>, e.g. allowedOperationsPerNfType),
no branch fires, localMapKeyPair stays NULL, and the generated code
calls OpenAPI_list_add(list, NULL) -> listEntry_create(NULL) -> abort.
This is remotely triggerable: NFProfile is parsed from peer/NRF input.

Template fix (r19, openapitools 7.20.0):
  - add isDate / isDateTime branches in both parseFromJSON and
    convertToJSON map blocks (DateTime is carried as a JSON string,
    handled like isString); convertToJSON previously also dropped the
    value silently for these maps.
  - guard OpenAPI_list_add with a NULL check so any remaining
    unhandled value category (e.g. array-valued maps) fails the parse
    gracefully instead of aborting the process.

Regenerated the two affected models (nf_profile, nf_service).
DateTime maps now round-trip correctly; the array-valued maps are
rejected instead of crashing pending full map<string,array> support.

Issues: #4649
2026-06-28 08:34:51 +09:00
..
r16-20210629-openapitools-5.2.0 [SBI] Crash occurs when ENUM in the MAP (#2103) 2023-03-01 17:50:25 +09:00
r16-20230226-openapitools-6.4.0 [SBI] Crash occurs when ENUM in the MAP (#2103) 2023-03-01 17:50:25 +09:00
r17-20230301-openapitools-6.4.0 [UDM][UDR] Add support for dataset-names resource (#4105) 2025-10-17 09:16:28 +09:00
r17-20260316-openapitools-7.20.0 sbi: update SBI implementation to 3GPP Release-19 2026-04-06 17:55:54 +09:00
r19-20260402-openapitools-7.20.0 sbi: Fix NULL list-add abort on map values of type DateTime/array 2026-06-28 08:34:51 +09:00