rtp_engine: rtcp_report_to_json can overflow the ssrc integer value

When writing an RTCP report to json the code attempts to pack the "ssrc" and
"source_ssrc" unsigned integer values as a signed int value type. This of course
means if the ssrc's unsigned value is greater than that which can fit into a
signed integer value it gets converted to a negative number. Subsequently, the
negative value goes out in the json report.

This patch now packs the value as a json_int_t, which is the widest integer type
available on a given system. This should make it so the value no longer
overflows.

Note, this was caught by two failing tests hep/rtcp-receiver/ and
hep/rtcp-sender.

Change-Id: I2af275286ee5e795b79f0c3d450d9e4b28e958b0
This commit is contained in:
Kevin Harwell
2018-09-17 15:35:05 -05:00
committed by Corey Farrell
parent dec6ebd9e1
commit 755febe497
7 changed files with 101 additions and 37 deletions

View File

@@ -74,6 +74,9 @@ AC_DEFUN([_JANSSON_CONFIGURE],
JANSSON_LIB="-L${JANSSON_DIR}/dest/lib -ljansson"
PBX_JANSSON=1
# We haven't run install yet
JANSSON_DEFINE_JSON_INT([$JANSSON_DIR]/source/src/)
AC_SUBST([JANSSON_BUNDLED])
AC_SUBST([PBX_JANSSON])
AC_SUBST([JANSSON_LIB])
@@ -87,3 +90,19 @@ AC_DEFUN([JANSSON_CONFIGURE],
_JANSSON_CONFIGURE()
fi
])
AC_DEFUN([JANSSON_DEFINE_JSON_INT],
[
# Define the ast_json_int_t (large integer type) to match jansson's
saved_cppflags="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${JANSSON_INCLUDE}"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <$1jansson.h>],
[#if !JSON_INTEGER_IS_LONG_LONG
#error "not long long"
#endif
])],
[AC_DEFINE([AST_JSON_INT_T], [long long], [Define to 'long' or 'long long'])],
[AC_DEFINE([AST_JSON_INT_T], [long], [Define to 'long' or 'long long'])])
CPPFLAGS="${saved_cppflags}"
])