Consider using weak ptrs for mSegmentReader/mSegmentWriter in h2 code
Categories
(Core :: Networking: HTTP, task, P2)
Tracking
()
People
(Reporter: mayhemer, Assigned: mayhemer)
References
Details
(Keywords: sec-want, Whiteboard: [necko-triaged][will fix sec-high UAFs])
Attachments
(3 files)
Currently those are raw ptrs. We never nullify them and we use them expecting to be non-null. When the outer class is released, those members keep refs to released memory, causing e.g. UAF bug 1402014.
I think these are single thread used (socket thread) so weak ptr would do well here to avoid cycles and UAFs.
Updated•6 years ago
|
Updated•6 years ago
|
![]() |
Assignee | |
Comment 1•6 years ago
|
||
Existing implementers of nsAHttpSegmentReader/nsAHttpSegmentWriter already mix* nsSupportsWeakReference and SupportsWeakPtr<T>. We need to consolidate first, I vote for SupportsWeakPtr<> . It's more modern.
-
- nsHttpConnection was added along with HalfOpen nsSupportsWeakReference in bug bug 1341572.
![]() |
Assignee | |
Comment 2•6 years ago
|
||
Making base classes SupportsWeakPtr-derived + the final class again SupportsWeakPtr-derived (for it's own type) causes a compilation error for SelfReferencingWeakPtr() being declared on base and derived again with only the return type differing.
I tried some template EnableIf magic, but that doesn't work as I'd like to.
![]() |
Assignee | |
Comment 3•6 years ago
|
||
![]() |
Assignee | |
Comment 4•6 years ago
|
||
Nathan, FYI, this bug is the main motivation for bug 1580182. I don't want to add dependencies to open bugs here.
![]() |
Assignee | |
Comment 5•6 years ago
|
||
![]() |
Assignee | |
Comment 6•6 years ago
|
||
Depends on D45882
![]() |
Assignee | |
Comment 8•5 years ago
|
||
(In reply to Honza Bambas (:mayhemer) from comment #7)
(add more info what blocks me)
I'll go with Comment 6 and see how it goes.
![]() |
Assignee | |
Comment 9•5 years ago
|
||
Releasing this bug from now, I don't think we have an immediate problem here. This could be actually considered an enhancement/improvement of the existing code only.
Updated•3 years ago
|
Comment 10•3 years ago
|
||
Fixed in bug 1667102 (I think).
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Description
•