From dbcc64ad3b6f1aecca80b91618c13f01fd640140 Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Mon, 25 Mar 2024 15:53:17 +0000 Subject: [PATCH] HPCC-31521 Prevent crash in dafilesrv with an invalid filter Signed-off-by: Gavin Halliday --- rtl/eclrtl/rtlnewkey.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rtl/eclrtl/rtlnewkey.cpp b/rtl/eclrtl/rtlnewkey.cpp index 12d7771ca53..48af5a62e52 100644 --- a/rtl/eclrtl/rtlnewkey.cpp +++ b/rtl/eclrtl/rtlnewkey.cpp @@ -2159,12 +2159,14 @@ void RowFilter::addFilter(const IFieldFilter & filter) const IFieldFilter & RowFilter::addFilter(const RtlRecord & record, const char * filterText) { - IFieldFilter & filter = *deserializeFieldFilter(record, filterText); - filters.append(filter); - unsigned fieldNum = filter.queryFieldIndex(); + IFieldFilter * filter = deserializeFieldFilter(record, filterText); + if (!filter) + throw makeStringExceptionV(0, "Could not process filter %s", filterText); + filters.append(*filter); + unsigned fieldNum = filter->queryFieldIndex(); if (fieldNum >= numFieldsRequired) numFieldsRequired = fieldNum+1; - return filter; + return *filter; } bool RowFilter::matches(const RtlRow & row) const