Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
d43c1927
Commit
d43c1927
authored
3 years ago
by
Olivier Dion
Browse files
Options
Downloads
Patches
Plain Diff
ice_transport: Fix use after free of pj_pool
Gitlab:
#583
Change-Id: Iddd1b582595daee498b383a11c6323546d14bef4
parent
8be23c43
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ice_transport.cpp
+12
-4
12 additions, 4 deletions
src/ice_transport.cpp
src/ice_transport.h
+3
-2
3 additions, 2 deletions
src/ice_transport.h
with
15 additions
and
6 deletions
src/ice_transport.cpp
+
12
−
4
View file @
d43c1927
...
...
@@ -213,6 +213,8 @@ public:
std
::
atomic_bool
destroying_
{
false
};
onShutdownCb
scb
{};
std
::
shared_ptr
<
pj_caching_pool
>
cp_
;
};
//==============================================================================
...
...
@@ -331,6 +333,7 @@ IceTransport::Impl::Impl(const char* name, const IceTransportOptions& options)
upnp_
.
reset
(
new
upnp
::
Controller
());
auto
&
iceTransportFactory
=
Manager
::
instance
().
getIceTransportFactory
();
cp_
=
iceTransportFactory
.
getPoolCaching
();
config_
=
iceTransportFactory
.
getIceCfg
();
// config copy
if
(
options
.
tcpEnable
)
{
config_
.
protocol
=
PJ_ICE_TP_TCP
;
...
...
@@ -1696,13 +1699,18 @@ IceTransport::link() const
//==============================================================================
IceTransportFactory
::
IceTransportFactory
()
:
cp_
()
:
cp_
(
new
pj_caching_pool
(),
[](
pj_caching_pool
*
p
){
pj_caching_pool_destroy
(
p
);
delete
p
;
})
,
ice_cfg_
()
{
sip_utils
::
register_thread
();
pj_caching_pool_init
(
&
cp_
,
NULL
,
0
);
pj_caching_pool_init
(
cp_
.
get
(),
NULL
,
0
);
pj_ice_strans_cfg_default
(
&
ice_cfg_
);
ice_cfg_
.
stun_cfg
.
pf
=
&
cp_
.
factory
;
ice_cfg_
.
stun_cfg
.
pf
=
&
cp_
->
factory
;
// v2.4.5 of PJNATH has a default of 100ms but RFC 5389 since version 14 requires
// a minimum of 500ms on fixed-line links. Our usual case is wireless links.
...
...
@@ -1715,7 +1723,7 @@ IceTransportFactory::IceTransportFactory()
IceTransportFactory
::~
IceTransportFactory
()
{
pj_caching_pool_destroy
(
&
cp_
);
}
std
::
shared_ptr
<
IceTransport
>
...
...
This diff is collapsed.
Click to expand it.
src/ice_transport.h
+
3
−
2
View file @
d43c1927
...
...
@@ -279,10 +279,11 @@ public:
* PJSIP specifics
*/
pj_ice_strans_cfg
getIceCfg
()
const
{
return
ice_cfg_
;
}
pj_pool_factory
*
getPoolFactory
()
{
return
&
cp_
.
factory
;
}
pj_pool_factory
*
getPoolFactory
()
{
return
&
cp_
->
factory
;
}
std
::
shared_ptr
<
pj_caching_pool
>
getPoolCaching
()
{
return
cp_
;
}
private
:
pj_caching_pool
cp_
;
std
::
shared_ptr
<
pj_caching_pool
>
cp_
;
pj_ice_strans_cfg
ice_cfg_
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment