The `g729_create()` was previously declared with three arguments:
`(format_parameters, format_parameters_out, format_description**)`
and the mismatch was hidden by casting it to `amci_codec_init_t`.
The core itslef still calls the codec init with two arguments only:
`(format_parameters, fmt_i)`
As a result, the codec never fills the caller's `fmt_i`,
and `*format_description = ...` writes 8 bytes to whatever address
was left in the third argument register.
If that register points to `fmt_i`,
the `AmAudioRtpFormat::initCodec()` then reads uninitialized stack
and may pick a bogus frame size from it
(e.g. seen as `frame_size = 131074`, which then overflowed
the media processor buffer). Otherwise it is a stray write
into an arbitrary memory location on every G.729 stream setup.
Use the two-argument signature, fill the caller's array
(as other codecs do) and drop the cast, so the compiler
validates the signature. Also fix the encoded frame size:
G.729 at 20ms is 20 bytes (33 is the GSM one).
Change-Id: I791c300892bd905b72314c6c84aa3077e71c64fd
In case the session originator never declared SST support
(with `aleg_sst_enable=yes`), then remove all possible SST
related headers and `timer` option tags where present.
This gets removed in all sip responses/requests going
towards the caller in this case.
Change-Id: I960fa09d00a8f324665b89d2e3ab0b44cbfcd677
For the case when the remote side doesn't explicitly state
it supports the `timer` SIP extension with `Supported: timer`,
try to fallback to `Require: timer` which is a guarantee for the case
with the UAC responsible for the SST timers.
Also add this fallback for the case with requests, e.g. when
UPDATE comes from the remote side to SEMS, and doesn't explicitly
declare the timers support with `Supported: timer` but still adds
the `Require: timer` one (most probably with UAS as a refresher).
Change-Id: Ic2ea79352535413568e4e3e9481cff1a29e43d7a
Introduce a pair of getter and setter.
Then use them to appeal to `AmSessionTimerConfig::StrictMode`.
Then move the `AmSessionTimerConfig::StrictMode` to private
scope for incapsulation reasons, this is now possible
because of having the getter and setter.
Change-Id: I1cf6d9bbb30be925b8b885b36cbc123a96d334cb
Upon sending request/reply (`SessionTimer::onSendRequest()` /
`SessionTimer::onSendReply()`) don't re-append `Session-Expires`
(and rest of timer related headers) if this leg doesn't actually
support them.
Appending them may just confuse remote side and it may
act strictly and drop the call (e.g. remote side didn't explicitly
declare it supports timers, but we still sent it `Session-Expires`).
By default we always assume that remote side supports SST timers,
unless not proved the opposite with absent SST related headers
in any first seen 200OK or INVITE/UPDATE request. Then it gets
disabled. This policy is quite explicit and allows to gracefully
step back from SST scheduling, if remote side doesn't support timers.
Change-Id: I8581418c60bde912e01e2429844720dc19034c81
Make both `updateTimer()` overloads be returning true/false,
this will allow to react on the func caller's side to act
accordingly whenever required.
Change-Id: Iba6bfa6b21e74d657652c649064fe0a93ad6f1eb
Check also for requests (as well as for answers) that B2B's profile
actually supports timers, before to proceed with processing.
Change-Id: If86ab5a546040781715812eb882fbdb314462078
Just by default construct as true.
By default we always assume that remote side supports SST timers,
unless not proved the opposite with absent SST related headers
in any first seen 200OK or INVITE/UPDATE request.
Then it gets disabled.
This policy is quite explicit and allows to gracefully
step back from SST scheduling, if remote side doesn't support timers.
Change-Id: I422c76c42d44bcf2e775ffb9afa5842a9def1402
Introduce explicit policy for within-dialog SST support:
- whenever remote side (call leg) doesn't explicitly declare
it supports timers (with `Supported: timer`), disable all
previously set timers for this particular leg
- this touches request originator, as well as answerer
- requests: only UPDATE and INVITE methods are affected
- answers: only positive answers are affected
- by default this behavior is always disabled if not enabled
explicitly in the profile's config with `sst_strict_mode`
- sst_strict_mode takes either `yes` or `no`
P.S.: the `sst_strict_mode` must not be initialized to true
by default, because RFC 4028 explicitly tells to support
the operation even when only one UA understands session timers.
So we have to be quite accurate and not enforce the strict mode.
Change-Id: Ie6647eb061a73dc052367dbd291589198487093c
Only for UPDATE method for now, track whether remote side
actually declares it supports timers, if not remove.
This may affect things, in case remote side expects timers
should have been declared only once during the session
origination, but all in all remote side must always add
the `Supported: timer` header to keep us explicitly aware.
Additionally: improve logs.
Change-Id: I80d4efbe38701b95549d02830392b93019cc2b85
No need to do local copy operations, because:
- local copy on stack created
- then another copy on stack created when returning
So this does two copy operations.
Instead just do one during return, this is still covered
with the lock guard.
Additionally: split `getMaxSessionNum()` into getter
and setter, because the name is misleading now.
Hence those callers, who want to get the max session number,
are obligated to also update to the new value.
Change-Id: Icc775d9236d5c80de829c55638e1da47ae095289
Update the usage of the `getParameter()` through
the modules, whereas the default value isn't given.
Change-Id: I4c725639f56b70e5548fa3da321c8452675cdf99
uac_auth: fix 407 auth retry failing due to stuck OA state
When SEMS sent an INVITE with SDP to a peer requiring proxy
authentication, the 407 response was forwarded to the caller
instead of being handled transparently with a retry.
Root cause: AmOfferAnswer::onReplyIn() did not reset the OA state
for error replies (>= 300). After the initial INVITE, OA state
was OA_OfferSent. When the 407 arrived (no SDP body), the state
remained OA_OfferSent. UACAuth then tried to retry the INVITE
with the original SDP body, but onTxSdp() rejected it:
"There is already a pending offer".
Fix: add early return with clearTransitionalState() at the top of
AmOfferAnswer::onReplyIn() for replies with code >= 300, matching
the behavior already present in sems-pbx. This ensures the OA
state is reset to OA_None before UACAuth attempts the retry.
Additionally, store req.r_uri in SIPRequestInfo and use it for
digest URI computation instead of dlg->getRemoteUri(). This
ensures the Authorization uri field always matches the original
Request-URI, as required by RFC 2617, regardless of any dialog
state changes between the initial request and the 407 handler.
Change-Id: I780bc98f193421481156de3f69497d26b893c49d
This module initialises and starts the StatsUDPServer. Stop its worker
when the module is destroyed.
Change-Id: I265d7ee103866a5946b066e4e7d42376e3510cac
The parsing code expect a null-terminated string. Make sure the string
is.
Use correct ssize_t as return value.
Change-Id: I2590dead0db5ca839ebe5fe7506b4edfe524d164
This makes sure we use the system library, with any updates coming from
upstream, including security fixes.
Change-Id: I3bc01b99fa4c5f107d28a819dc0e1c1eac155e91
Use overloading for the various flavours of str2int functions. This has
the benefit of automatically choosing the appropriate function for
aliased types that may be one or the other underlying type, such as
size_t.
Do a mass renaming of all relevant instances.
Change-Id: I7abb6b9031ee53332d2b04a6cba4a6cc667a4807
Do the dummy read in pieces of 4096. This eliminates the need for a
heap-allocated buffer, which in turn eliminates a possible mem leak.
Change-Id: Ibbbd6f2ef1fa315fad94715c65a74426b3448862
Warned-by: Coverity
Add cast to make it clear that this is an intentional truncation of a
time_t to an int.
Change-Id: I676f7eb30d4016a531e94975fb230c2d7c9aa9f7
Warned-by: Coverity
Fixes:
Unchecked return value from library (CHECKED_RETURN).
check_return: Calling fseek(fp, 9L, 0) without checking return value.
This library function may fail and return an error code.
Change-Id: Id7c861a7a78df72968e0755dca47d9a70e736332
Fixes:
Untrusted allocation size (TAINTED_SCALAR)
tainted_data: Passing tainted expression chunk_size - 16U
to wav_dummyread, which uses it as an allocation size.
Change-Id: Ide2c65c1c6c440b4e5aeb610cbc813631b24a6a6
Fixes:
Unchecked return value from library (CHECKED_RETURN),
check_return: Calling fseek(fp, chunk_size, 1)
without checking return value.
This library function may fail and return an error code.
Change-Id: Ibbf984f66f9efd2fe516efc9ab431a19396fd718
For the PRACK transcations (e.g. PRACK/401) update the
remote tag as well as route set.
Scope: `AmSipDialog::onRxReplyStatus()`
Additionally: do not reset remote tag during the authentication
process for PRACK methods, in: `UACAuth::onSipReply()`.
Change-Id: Ibd4e4ee737287bab3883b74a32ded6a966ec62ab
Fix instances of make rules not being parallel execution safe, where the
targets declare a list of dependencies which depend on the order they
have been declared to be executed serially, otherwise these can cause
race conditions.
Either move some of the dependencies down into their transitive
dependencies, or rearrange them to call $(MAKE) to force a serial
point. In other instances add missing dependencies to make sure the
objects to install have previously been built.
Change-Id: I21b499557ac5e9faa603841fa1882b58239ee650
Fix for:
fft.c: In function 'WebRtcIsac_Fftradix':
fft.c:338:22: warning: the comparison will always evaluate as 'false' for the address of 'Tmp0' will never be NULL [-Waddress]
338 | if (fftstate->Tmp0 == NULL || fftstate->Tmp1 == NULL || fftstate->Tmp2 == NULL || fftstate->Tmp3 == NULL
| ^~
In file included from fft.h:34,
from fft.c:126:
structs.h:250:10: note: 'Tmp0' declared here
250 | double Tmp0[MAXFFTSIZE];
| ^~~~
fft.c:338:48: warning: the comparison will always evaluate as 'false' for the address of 'Tmp1' will never be NULL [-Waddress]
338 | if (fftstate->Tmp0 == NULL || fftstate->Tmp1 == NULL || fftstate->Tmp2 == NULL || fftstate->Tmp3 == NULL
| ^~
structs.h:251:10: note: 'Tmp1' declared here
251 | double Tmp1[MAXFFTSIZE];
| ^~~~
fft.c:338:74: warning: the comparison will always evaluate as 'false' for the address of 'Tmp2' will never be NULL [-Waddress]
338 | if (fftstate->Tmp0 == NULL || fftstate->Tmp1 == NULL || fftstate->Tmp2 == NULL || fftstate->Tmp3 == NULL
| ^~
structs.h:252:10: note: 'Tmp2' declared here
252 | double Tmp2[MAXFFTSIZE];
| ^~~~
fft.c:338:100: warning: the comparison will always evaluate as 'false' for the address of 'Tmp3' will never be NULL [-Waddress]
338 | if (fftstate->Tmp0 == NULL || fftstate->Tmp1 == NULL || fftstate->Tmp2 == NULL || fftstate->Tmp3 == NULL
| ^~
structs.h:253:10: note: 'Tmp3' declared here
253 | double Tmp3[MAXFFTSIZE];
| ^~~~
fft.c:339:25: warning: the comparison will always evaluate as 'false' for the address of 'Perm' will never be NULL [-Waddress]
339 | || fftstate->Perm == NULL) {
| ^~
structs.h:254:7: note: 'Perm' declared here
254 | int Perm[MAXFFTSIZE];
| ^~~~
Change-Id: I7060e20d532e80f2ec78c04999676c86136ae34a
This was a workaround for Solaris specific issues in the install program
there. The problem is that this can end up generating empty files, that
will not be detected by the packaging system as it will find the file is
present on destination and thus does not need to be installed.
Change-Id: Ib6107957cbf03c4e7da6cf2998d9103224f674d3
It's been noticed that we have an improper implementation,
which attempts to move the pointer to the char array like this:
`input = param_size + 1;`
It's not right, it should be like that:
`input += (param_size + 1);`
Change-Id: Ia924a398cb37a64a06dfa385db6a0409f1e93e82
This commit takes car of the following mistake in the code:
opus.c: In function 'read_param':
opus.c:178:5: warning: statement with no effect [-Wunused-value]
178 | input;
| ^~~~~
opus.c:186:8: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
186 | input=param_size+1;
| ^
opus.c:191:5: warning: statement with no effect [-Wunused-value]
191 | input;
| ^~~~~
opus.c:197:2: warning: statement with no effect [-Wunused-value]
197 | input;
| ^~~~~
opus.c: In function 'decode_format_parameters':
opus.c:257:4: warning: statement with no effect [-Wunused-value]
257 | buffer;
| ^~~~~~
Change-Id: I469d9cc433eaebe5e3ffbe32b963363dd29a2aac
We should deprecate unused variables and functions:
entropy_coding.c:95:14: warning: 'log2_Q10_B' defined but not used [-Wunused-function]
95 | static short log2_Q10_B( int x )
| ^~~~~~~~~~
entropy_coding.c:78:23: warning: 'stepwise' defined but not used [-Wunused-function]
78 | static WebRtc_UWord32 stepwise(WebRtc_Word32 dinQ10) {
| ^~~~~~~~
entropy_coding.c:72:28: warning: 'lbcnQ10' defined but not used [-Wunused-const-variable=]
72 | static const WebRtc_Word32 lbcnQ10 = -402874;
| ^~~~~~~
entropy_coding.c:71:28: warning: 'ccnQ10' defined but not used [-Wunused-const-variable=]
71 | static const WebRtc_Word32 ccnQ10 = 722631;
| ^~~~~~
entropy_coding.c:70:28: warning: 'bcnQ10' defined but not used [-Wunused-const-variable=]
70 | static const WebRtc_Word32 bcnQ10 = -581224;
| ^~~~~~
entropy_coding.c:69:28: warning: 'acnQ10' defined but not used [-Wunused-const-variable=]
69 | static const WebRtc_Word32 acnQ10 = 426;
| ^~~~~~
Change-Id: Ie45a2685c445eb5c7c5bfc75d7bda9ba2ba26a50
This is a fix for the following warning:
entropy_coding.c:101:11: warning: 'WebRtcSpl_NormU32' is static but used in inline function 'log2_Q10_B' which is not static
101 | zeros = WebRtcSpl_NormU32( x );
| ^~~~~~~~~~~~~~~~~
entropy_coding.c:92:10: warning: 'kRPointsQ10' is static but used in inline function 'stepwise' which is not static
92 | return kRPointsQ10[ind];
| ^~~~~~~~~~~
This happens because the inline function has inside it a call
to the static function.
To fix the warning, we just make the `log2_Q10_B()` and `stepwise()` functions
static. It's quite safe, since they are not even in use by anything.
Change-Id: Id6588d85c7d347d5669d6495188e798fe7c70b05
It's been noticed that we are using `memcpy` for copying of the data,
where the source and destination overlaps.
This begets the following warning:
In function 'memcpy',
inlined from 'Decode' at iLBC_decode.c:254:16:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: warning: '__builtin_memcpy' accessing 428 bytes at offsets 0 and 160 overlaps 268 bytes at offset 160 [-Wrestrict]
34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'memcpy',
inlined from 'Decode' at iLBC_decode.c:302:16:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: warning: '__builtin_memcpy' accessing 428 bytes at offsets 0 and 160 overlaps 268 bytes at offset 160 [-Wrestrict]
34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:495,
from iLBC_encode.c:15:
In function 'memcpy',
inlined from 'iLBC_encode' at iLBC_encode.c:311:16:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: warning: '__builtin_memcpy' accessing 428 bytes at offsets 0 and 160 overlaps 268 bytes at offset 160 [-Wrestrict]
34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'memcpy',
inlined from 'iLBC_encode' at iLBC_encode.c:389:16:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: warning: '__builtin_memcpy' accessing 428 bytes at offsets 0 and 160 overlaps 268 bytes at offset 160 [-Wrestrict]
34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The problem is that `memcpy` should not be used, when dst memory overlaps with src memory.
We should update such usage of `memcpy` and swap it with `memmove`
From the manpage of the `memcpy`:
>> The memory areas should not overlap. Use memmove(3) if the memory areas do overlap.
Change-Id: I5e3e65587fad92c91bb298e4e5415db1fd0c0371
There are cases when calls coming to a subscriber of C5 CE,
is being challenged by this subscriber, the use case for that could be
if for e.g. we have a PBX/SBC connected to NGCP via subscriber's object.
Current implementation of SEMS works so, that in case parameters;
'enable_auth' and 'enable_aleg_auth' are set to value 'yes',
SEMS tries to pass the digest for the calling party.
This leads to the empty 'username' and wrong 'response' parameters of
the Proxy-Authorization header, eventually the Authorization process is failed.
This is to be changed, so in case 'u=', 'p=' and 'd=' have not been
previously sent by the Proxy (in 'P-App-Param:'), or rather they are empty, authentication should be transparent,
hence be processed by the calling side, with no interfer from SEMS into that.
(real ticket number: TT#128701)
Change-Id: I989dbe3ed9d5a1d2ec73cb0ad081254c9b9eca32
Unset Sems internal Session Timers in case B leg doesn't support it
(no Timer in Supported header of 200OK message).
(real ticket number: TT#29926)
Change-Id: Id27748751f36017e12d6ae84bce602a9995f9d34
- Make errors fatal, so that they do not get ignored anymore.
- Use sane make variables that a shell will accept as valid, otherwise
the exports do not work at all.
- Do not use system paths when we should use in-tree ones.
(real ticket number: TT#6850)
Change-Id: I07af8f38cc37c2fa36b6b10559283a7c477d2d36