From 8ebd6eead55c088458b44ebf116663f325bdb501 Mon Sep 17 00:00:00 2001 From: Jason Dellaluce Date: Thu, 16 May 2024 12:38:38 +0000 Subject: [PATCH] fix(userspace/libsinsp): support comparisons with double fields Signed-off-by: Jason Dellaluce --- userspace/libsinsp/value_parser.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/userspace/libsinsp/value_parser.cpp b/userspace/libsinsp/value_parser.cpp index bf2a90b1d7..7285cfbc6a 100644 --- a/userspace/libsinsp/value_parser.cpp +++ b/userspace/libsinsp/value_parser.cpp @@ -167,6 +167,17 @@ size_t sinsp_filter_value_parser::string_to_rawval(const char* str, uint32_t len } break; + case PT_DOUBLE: + { + check_storage_size(str, max_len, sizeof(double)); + // note(jasondellaluce): we historically never supported parsing + // floating point number values, so as a starter we just stick to + // integer numberd + // todo(jasondellaluce): support floating point (double) value parsing + *(double*)storage = (double)sinsp_numparser::parsed32(str); + parsed_len = sizeof(double); + break; + } case PT_IPADDR: if(memchr(str, '.', len) != NULL) {