]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 5290: pure virtual call in Ftp::Client constructor (#1429)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 29 Jul 2023 17:44:59 +0000 (17:44 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 29 Jul 2023 18:24:45 +0000 (18:24 +0000)
    FATAL: Dying from an exception handling failure;
    exception: [no active exception]

Converting `this` to CbcPointer in a constructor of an abstract class
like Ftp::Client does not work because our virtual toCbdata() method
remains pure until the final/child class constructor runs.

Conceptually, the bug was probably introduced in 2013 commit 434a79b,
when FTP class hierarchy grew, making Ftp::Client an abstract class, but
the trigger was recent commit 337b9aa that removed CBDATA_CLASS() from
Ftp::Client class declaration. We discovered, described, and addressed
several such bugs in that commit, but we missed this case.

src/clients/FtpClient.h

index cbe0e58538ae236273b25a4cbd6462857555ced7..0db3b2da047e0adf19746cf5fd50a0358337cd4b 100644 (file)
@@ -109,6 +109,8 @@ public:
 /// FTP client functionality shared among FTP Gateway and Relay clients.
 class Client: public ::Client
 {
+    CBDATA_INTERMEDIATE();
+
 public:
     explicit Client(FwdState *fwdState);
     ~Client() override;