]> git.ipfire.org Git - thirdparty/squid.git/commit
HTTP: Protect just-parsed responses from accidental destruction (#1752)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Sat, 23 Mar 2024 21:24:03 +0000 (21:24 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 24 Mar 2024 15:02:35 +0000 (15:02 +0000)
commit80a6a08a94a8c1029b907169e5803fe2e5e9a422
tree22ad9b24442ab9a78267c81d5afe976538a10d16
parent0c060c02e48a1fedfb5c163f8ec54b8aa7f68588
HTTP: Protect just-parsed responses from accidental destruction (#1752)

The lack of HttpReply locking meant that we could not (safely) pass the
freshly created reply object to ACLFilledChecklist because the checklist
destructor would unwittingly destroy the object (by unlocking it). There
is at least one applicable ACL check in handle1xx(), but we got lucky
because that method adds the reply object to ALE, increasing its
reference counter. This change stops relying on such "external" locks.

This change also protects from HttpReply memory leaks when an exception
is thrown between HttpReply creation and a setVirginReply() call.

TODO: Fix all cases where newly created HttpReply objects are remembered
using raw pointers (but may be passed to locking/unlocking code).
src/http.cc
src/http.h