mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
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:
committed by
Corey Farrell
parent
e3e24a0844
commit
31fba4e869
@@ -3379,8 +3379,8 @@ static struct ast_json *rtcp_report_to_json(struct stasis_message *msg,
|
||||
char str_lsr[32];
|
||||
|
||||
snprintf(str_lsr, sizeof(str_lsr), "%u", payload->report->report_block[i]->lsr);
|
||||
json_report_block = ast_json_pack("{s: i, s: i, s: i, s: i, s: i, s: s, s: i}",
|
||||
"source_ssrc", payload->report->report_block[i]->source_ssrc,
|
||||
json_report_block = ast_json_pack("{s: I, s: i, s: i, s: i, s: i, s: s, s: i}",
|
||||
"source_ssrc", (ast_json_int_t)payload->report->report_block[i]->source_ssrc,
|
||||
"fraction_lost", payload->report->report_block[i]->lost_count.fraction,
|
||||
"packets_lost", payload->report->report_block[i]->lost_count.packets,
|
||||
"highest_seq_no", payload->report->report_block[i]->highest_seq_no,
|
||||
@@ -3412,8 +3412,8 @@ static struct ast_json *rtcp_report_to_json(struct stasis_message *msg,
|
||||
}
|
||||
}
|
||||
|
||||
json_rtcp_report = ast_json_pack("{s: i, s: i, s: i, s: o, s: o}",
|
||||
"ssrc", payload->report->ssrc,
|
||||
json_rtcp_report = ast_json_pack("{s: I, s: i, s: i, s: o, s: o}",
|
||||
"ssrc", (ast_json_int_t)payload->report->ssrc,
|
||||
"type", payload->report->type,
|
||||
"report_count", payload->report->reception_report_count,
|
||||
"sender_information", json_rtcp_sender_info ?: ast_json_null(),
|
||||
|
Reference in New Issue
Block a user