Hello Vadim Yanitskiy, Jenkins Builder,

I'd like you to reexamine a change. Please visit

    https://gerrit.osmocom.org/12716

to look at the new patch set (#4).

Change subject: osmo_fsm_inst_state_chg(): clamp timeout_secs to <= ~68 years
......................................................................

osmo_fsm_inst_state_chg(): clamp timeout_secs to <= ~68 years

During testing of the upcoming tdef API, it became apparent that passing very
large timeout values to osmo_fsm_inst_state_chg() wraps back in the number
range, and might actually result in effectively very short timeouts instead.

Since time_t's range is not well defined across platforms, use a reasonable
maximum value of signed 32 bit integer. Hence this will be safe at least on
systems with an int32_t for struct timeval.tv_sec and larger.

Clamp the osmo_fsm_inst_state_chg() timeout_secs argument to a maximum of
0x7fffffff, which amounts to just above 68 years:
float(0x7fffffff) / (60. * 60 * 24 * 365.25) = 68.04965038532715

(In upcoming patch Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5, this can be
verified to work by invoking tdef_test manually with a cmdline argument passed
to enable the range check.)

Change-Id: I35ec4654467b1d6040c8aa215049766089e5e64a
---
M src/fsm.c
1 file changed, 13 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/16/12716/4
--
To view, visit https://gerrit.osmocom.org/12716
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I35ec4654467b1d6040c8aa215049766089e5e64a
Gerrit-Change-Number: 12716
Gerrit-PatchSet: 4
Gerrit-Owner: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Vadim Yanitskiy <[email protected]>
Gerrit-CC: Harald Welte <[email protected]>

Reply via email to