mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00

The JSON decoder correctly cannot decode (overflow) negative values (e.g., `-1`) for fields of type `uint64`, as `-1` is used to represent `max` in `POSIXRlimit`. To handle this, we use `tmpSpecGenerator` to decode the request body. The `tmpSpecGenerator` replaces the `POSIXRlimit` type with a `tmpRlimit` type that uses the `json.Number` type for decoding values. The `tmpRlimit` is then converted into the `POSIXRlimit` type and assigned to the `SpecGenerator`. This approach ensures compatibility with the Podman CLI and remote API, which already handle `-1` by casting it to `uint64` (`uint64(-1)` equals `MaxUint64`) to signify `max`. Fixes: https://issues.redhat.com/browse/RUN-2859 Fixes: https://github.com/containers/podman/issues/24886 Signed-off-by: Jan Rodák <hony.com@seznam.cz>