[sr-dev] [kamailio/kamailio] sdpops: signedness issue w/ sess-version in o= line (Issue #3099)

Bastian Triller notifications at github.com
Mon May 2 12:58:31 CEST 2022


<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.

If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:

  * http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:

  * http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.

If there is no content to be filled in a section, the entire section can be removed.

You can delete the comments from the template sections when filling.

You can delete next line and everything above before submitting (it is a comment).
-->

<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
I incremented sess-version w/ value `2147483648` via `$sdp(sess_version) = -1` as well as `$sdp(sess_version) = 2147483648`.
sess-version in SDP should be 2147483649 but is `-1941279658`.

### Troubleshooting
[RFC4566 5.2. Origin ("o=")](https://datatracker.ietf.org/doc/html/rfc4566#section-5.2)
```
   <sess-version> is a version number for this session description.  Its
      usage is up to the creating tool, so long as <sess-version> is
      increased when a modification is made to the session data.  Again,
      it is RECOMMENDED that an NTP format timestamp is used.
```
[Wikipedia NTP Timestamps](https://en.wikipedia.org/wiki/Network_Time_Protocol#Timestamps)
```
The 64-bit binary fixed-point timestamps used by NTP consist of a 32-bit part for seconds and a 32-bit part for fractional second, giving a time scale that rolls over every 232 seconds (136 years) and a theoretical resolution of 2−32 seconds (233 picoseconds). NTP uses an epoch of January 1, 1900. Therefore, the first rollover occurs on February 7, 2036.[28][29]
```

#### Reproduction
Receive SDP w/ sess-version greater equal 2^31 (2147483648) and increase version via `$sdp(sess-version) = -1` or setting a value greater than 2^31.

<!--
If the issue can be reproduced, describe how it can be done.
-->

#### Log Messages

<!--
Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->

```
May 02 06:43:20.578496 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} <core> [core/parser/sdp/sdp_helpr_funcs.c:622]: extract_sess_version(): oline(46): >o=user1 53655765 2147483648 IN IP4 127.0.0.1
                                                            <
May 02 06:43:20.578501 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} <core> [core/parser/sdp/sdp_helpr_funcs.c:651]: extract_sess_version(): end 10: >2147483648<
May 02 06:43:20.578508 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} <core> [core/parser/sdp/sdp_helpr_funcs.c:506]: extract_mediaip(): located IP address [127.0.0.1] in `o=' field
May 02 06:43:20.578512 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} <core> [core/parser/sdp/sdp_helpr_funcs.c:506]: extract_mediaip(): located IP address [127.0.0.1] in `c=' field
May 02 06:43:20.578532 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:1918]: sdp_get_sess_version(): sdp_session_num 0 sess-version: 2147483648
May 02 06:43:20.578536 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:1923]: sdp_get_sess_version(): sdp_session_num 1
May 02 06:43:20.578576 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:1918]: sdp_get_sess_version(): sdp_session_num 0 sess-version: 2147483648
May 02 06:43:20.578581 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:1923]: sdp_get_sess_version(): sdp_session_num 1
May 02 06:43:20.578695 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:2111]: pv_set_sdp(): res->flags: 24
May 02 06:43:20.578702 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:2112]: pv_set_sdp(): PV_TYPE_INT: 16
May 02 06:43:20.578705 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:2113]: pv_set_sdp(): PV_VAL_INT: 8
May 02 06:43:20.578708 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:2116]: pv_set_sdp(): param.pvn.u.isname.name.n = 1
May 02 06:43:20.578710 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:2125]: pv_set_sdp(): do $sdp(sess_version) = -1941279658
May 02 06:43:20.578713 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:1918]: sdp_get_sess_version(): sdp_session_num 0 sess-version: 2147483648
May 02 06:43:20.578716 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:1923]: sdp_get_sess_version(): sdp_session_num 1
May 02 06:43:20.578750 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:1971]: sdp_set_sess_version(): old_sess_version_num: -2147483648  autoincrement: 0
May 02 06:43:20.578756 debian11 /usr/sbin/kamailio[121163]: DEBUG: {1 2 INVITE 1-121317 at 127.0.0.1} sdpops [sdpops_mod.c:1972]: sdp_set_sess_version(): *new_sess_version_num: -1941279658  autoincrement: 0
```

### Possible Solutions

<!--
If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix.
-->

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
version: kamailio 5.5.4 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 10.2.1
```

* **Operating System**:

<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `lsb_release -a` and `uname -a`)
-->

```
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
Linux debian11 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64 GNU/Linux
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3099
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/3099 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20220502/85de8d20/attachment.htm>


More information about the sr-dev mailing list