From 3a3a53ff0ff2cf977f54c7cafc9609aa73a19d02 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 11 Jun 2026 15:55:51 +0200 Subject: [PATCH] Add input guards to fortio_fread_buffer for parity with resdata PR #1189 Reject null buffers and negative buffer sizes up front, returning false instead of risking a null dereference or hitting util_abort. The buffer-overflow protection from the upstream fix is already present via #14144; these two input-validation guards are the remaining delta. --- ThirdParty/Ert/lib/ecl/fortio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ThirdParty/Ert/lib/ecl/fortio.c b/ThirdParty/Ert/lib/ecl/fortio.c index 8907590c4d..82f74b3c48 100644 --- a/ThirdParty/Ert/lib/ecl/fortio.c +++ b/ThirdParty/Ert/lib/ecl/fortio.c @@ -550,6 +550,11 @@ static int fortio_fread_record(fortio_type *fortio , char *buffer , int max_reco */ bool fortio_fread_buffer(fortio_type * fortio, char * buffer , int buffer_size) { + if (buffer == NULL && buffer_size != 0) + return false; + if (buffer_size < 0) + return false; + int total_bytes_read = 0; while (true) {