From: Victor Julien Date: Thu, 24 Mar 2022 15:53:31 +0000 (+0100) Subject: files: open/log debug validation bugon X-Git-Tag: suricata-7.0.0-beta1~792 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54d34c96f5119116a5db734f7657e7b0e13ac9fe;p=thirdparty%2Fsuricata.git files: open/log debug validation bugon Meant to find more cases where there is a mismatch. --- diff --git a/src/output-file.c b/src/output-file.c index c2a7027540..832e2e9923 100644 --- a/src/output-file.c +++ b/src/output-file.c @@ -96,11 +96,14 @@ int OutputRegisterFileLogger(LoggerId id, const char *name, FileLogger LogFunc, static void CloseFile(const Packet *p, Flow *f, File *file) { + DEBUG_VALIDATE_BUG_ON((file->flags & FILE_LOGGED) != 0); void *txv = AppLayerParserGetTx(p->proto, f->alproto, f->alstate, file->txid); if (txv) { AppLayerTxData *txd = AppLayerParserGetTxData(p->proto, f->alproto, txv); - if (txd) + if (txd) { txd->files_logged++; + DEBUG_VALIDATE_BUG_ON(txd->files_logged > txd->files_opened); + } } file->flags |= FILE_LOGGED; }