170 Commits
Author SHA1 Message Date
Magne Sjaastad 92e269ef4d #14901: Guard against crashes from corrupt Eclipse files and incomplete frustum
- RifEclipseOutputFileTools::timeSteps: avoid integer division by zero when
  the restart file has no INTEHEAD
- libecl ecl_grid: return NULL when the main EGRID grid cannot be created,
  and skip NNCHEAD blocks that cannot be read
- libecl well_info: skip wells when the restart header cannot be read
- cvf::Frustum::isOutside: do not assert on an incomplete frustum, cull nothing

Fixes #14901.
2026-10-12 17:16:11 +02:00
Magne Sjaastad de3996ee9e Fix four crashes found via automated stacktrace triage (#14702)
* Fail gracefully when exportSnapshots command has no main window
* Guard against unopened plot panels in selection change handler
* Guard ecl_rsthead_alloc against missing INTEHEAD_KW
* Guard against detached flow diag solution in solverInterface
* Never rewrite all crash-triage reports when updating registry
2026-09-08 11:16:38 +02:00
Magne Sjaastad 14a4b5ef53 #14381 Fail gracefully when reading truncated or corrupt SMSPEC file 2026-07-28 14:44:25 +02:00
Magne Sjaastad e35f9aa85e #14370 Guard against NULL base when selecting summary file lists 2026-07-28 11:26:18 +02:00
Magne Sjaastad 3a3a53ff0f 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.
2026-06-11 22:26:07 +02:00
Magne Sjaastad d339a34910 #14149 Fix crash when reading corrupt or truncated Eclipse INIT keyword
ecl_kw_fread_alloc() returns NULL if a keyword cannot be read, e.g. when
the backing file is truncated or corrupt. ecl_file_kw_load_kw() then
called ecl_file_kw_assert_kw() unconditionally, which dereferenced the
NULL keyword and caused a SIGSEGV.

Guard the assert and inv-map registration so they only run when the read
succeeded. The NULL keyword is propagated to the calling scope, which
already handles a missing keyword gracefully.
2026-06-10 17:46:13 +02:00
Magne Sjaastad 668b844051 #14144 Guard against buffer overflow when reading corrupt well data records
A truncated or corrupt restart file could provide a Fortran record-length header larger than the destination buffer, causing fortio_fread_record to fread past the heap allocation and crash. Bound each record read to the remaining buffer capacity and treat an oversized record as a read failure, which propagates up as a normal failed read instead of a segfault.
2026-06-08 15:54:52 +02:00
Magne Sjaastad 4e65583425 #14004 resdata: Backport robustness fixes from equinor/resdata#1166
Guard zero-length keywords in ecl_kw_max_min, increase grdecl buffer to 256 and bound sscanf widths, and validate dimensions and keyword sizes (COORD, ZCORN, MAPAXES, CORSNUM, ACTNUM) when loading GRDECL grids.
2026-05-19 07:58:37 +02:00
Magne Sjaastad 60f2ede781 Fix crash in ecl_file_scan when UNRST file is locked or being written
Add NULL stream guards in fortio_ftell and fortio_fseek__ to prevent SIGSEGV when fortio->stream is NULL during ecl_file_scan. This mirrors
the defensive fix applied to ESmry::loadData for UNSMRY files.
2026-03-17 14:03:11 +01:00
Kristian Bendiksen 8b457f2156 Fix: Memory leak in well_state_add_MSW2
The function `well_state_add_MSW2` in `well_state.cpp` would allocate
an `ecl_rsthead_type` object but would not free it in the case where
the `RSEG_KW` keyword was not found in the restart file view.

This would lead to a memory leak.

This commit fixes the issue by freeing the allocated object before
returning from the function in the error case.
2025-09-04 09:04:30 +02:00
Magne 57017a166c Add minimum requirements for CMake, gcc and clang
On Linux, link with stdc++exp
Define requirements in README
2025-05-09 15:54:28 +02:00
Magne Sjaastad a09a189214 Update to clang-tidy 18
* remove unused variable
* Use clang-18 for ResInsight build
* Update to clang-tidy-18
* Add NOLINTNEXTLINE
2025-04-14 20:31:11 +02:00
jonjenssen 9a9bb17a1b Bugfix: avoid keeping init file open. 2025-03-26 21:52:06 +01:00
jonjenssen 4518628013 Support skipping invalid IWEL records without shutting down ResInsight 2024-08-12 11:13:57 +02:00
jonjenssen 9a2be684a2 Fix building when you have both WINDOWS and POSIX mkdir detected. (#11523)
* Fix building when you have both WINDOWS and POSIX mkdir detected.
2024-06-20 07:16:02 +02:00
jonjenssen 4365b0dfb9 Grid import using opm-common improvements (#11438)
* Update opm-common EGRID reader to support LGRs, NNCs, dual porosity, unit system info and time step filters
* Rearrange well reading code into separate class
* Update resdata library to not require an ecl_grid when reading well information. Only lgr names are needed, allows reused by opm_common reader
2024-06-18 13:03:48 +02:00
Magne Sjaastad 98144078c8 Rename to resdata
* Rename to resdata
* Remove development feature for storing grid import type in project file
* Clean up comments
2024-04-22 19:56:10 +02:00
Magne Sjaastad c759a11888 Cmake cleanup and selected Qt6 adjustments
- Avoid warning using newer CMake by removing obsolete cmake requirements in sub projects
- Several adjustments preparing for Qt6
2024-04-17 15:06:51 +02:00
Kristian Bendiksen 852cd400b8 #10720 Summary Import: support upper/lower case mismatch between filename and extension.
Importing files with different casing in base name and extension would fail when
using libecl summary reader. E.g "norne_atw2013.SMSPEC" would fail since libecl
forces the extension to be lower case even though it is given the actual extension.

Removing the lowercasing allows more flexibility in the file naming.

The problem only occurs when the libecl summary reader is used, the opm-common
can already import these files.

Fixes #10720.
Fixes #10617.
2023-10-20 13:53:00 +02:00
Magne Sjaastad 0d8cf73677 #10493 Avoid crash during import of grid model from IX
The crash situation is caused by an invalid well state. Allowing the import to continue using the invalid well state seems to imported data correctly.
2023-08-11 21:30:27 +02:00
Magne Sjaastad bce8177033 Delete some unused variables and disable warnings 2023-05-21 15:15:09 +02:00
Magne Sjaastad c9839fcf93 #10191 Return ECLIPSE_UNDEFINED without crashing 2023-05-01 18:56:51 +02:00
Magne Sjaastad 448e3dfcbc #10191 Read NNC data from INIT file for Intersect files 2023-04-28 11:38:23 +02:00
Magne Sjaastad 1922a02fc3 #9139 Avoid crash for dual porosity case with NNC
libecl supports only import of NNC data for matrix. Disable asserts to avoid crash in file reader. No NNC fracture data is imported.
2023-02-15 13:55:50 +01:00
Magne Sjaastad af7fe8f00e #9844 Summary Restart: Add more guarding on empty strings
When trying to import a restart case, parsing of the restart path causes crash in some cases. Add more checking on NULL.
2023-02-14 19:11:14 +01:00
Magne Sjaastad 4e51516a96 Import of grid models: Support mix of lower and upper case letters in file name
* #9529 libecl: Allow mix of upper and lower case in file names
2022-12-16 07:00:45 +01:00
Magne Sjaastad 86af2b4dfc Export Sector Model: Add file path
* Export Sector Model: Add file path
* Avoid abort if a file cannot be opened
* Add missing return
2022-11-28 11:57:00 +01:00
Magne Sjaastad daa8d7305b #9455 libecl: Fix summary restart absolute path issues
Test for absolute path before other logic during extraction of summary restart file path.
2022-11-10 11:08:30 +01:00
Magne Sjaastad b1b0fd9d35 libecl: Fix for more data in summary restart path
Allocate 17 words of 8 characters each, add 1 for zero terminated string.
2022-11-09 17:11:21 +01:00
Kristian Bendiksen 29e1a72d76 libecl: Add more special-case MISC vectors 2022-05-31 22:16:24 +02:00
Kristian Bendiksen e7f27abae7 libecl: add support for network variables 2022-05-31 22:16:24 +02:00
Magne Sjaastad 640c59d682 #7942 Summary Plot: Make reading of summary data file more robust
- remove the gsl::not_null for pointer to curve data
- For summary cases linked to a grid model case, do not try to read the original location of file if grid file location is not valid (will happen when a project file is moved)
2021-09-02 15:55:43 +02:00
Magne Sjaastad e961dce97d #7944 Cell selection: Avoid crash for Pflotran simulation case 2021-09-02 15:55:43 +02:00
Magne Sjaastad 4666c45f66 #7065 WBHP for historic period reported as -99 in some cases
Use 0.0 instead of nan, as this behaves in a better way when computing statistics and visual display of curves.
2021-02-16 14:15:20 +01:00
Magne Sjaastad 1e0e429156 #7065 WBHP for historic period reported as -99 in some cases
Use NaN instead of -99 to indicate no data present
2021-02-16 11:10:17 +01:00
Magne Sjaastad 70dfdd9a41 #6869 Coarse Grid: Make sure empty coarsening cells are handled correctly
Based on fix by Jean-Paul Balabanian <jpb@equinor.com>
2020-11-03 04:34:40 -05:00
Gaute Lindkvist 0354664b8f Get rid of warning of CMake policy CMP0042 by copying in new libecl code 2020-10-20 11:05:10 +02:00
Gaute Lindkvist f199297f12 #5915 improve performance of NNC computation and limit to active cells 2020-05-13 12:19:03 +02:00
Magne Sjaastad dbe782a9a0 LibEcl : Add missing include for latest VS2019 2020-04-18 09:20:40 +02:00
Magne Sjaastad 89c306cb5a #5325 Summary Import : Avoid abort for incomplete summary data 2020-01-10 14:28:46 +01:00
Gaute Lindkvist 285433cbb8 #4927 Blind attempt at improving reliability of smspec import 2019-11-28 08:03:59 +01:00
Magne Sjaastad 157219e63d #5015 libecl : Make sure *.UNSMRY is closed properly after data is read
Earlier attempts to fix this caused major performance issues. Now closing the file stream when reading of vector data is completed, seems to work as expected.
2019-11-08 11:12:06 +01:00
Magne Sjaastad 4c9048cd6a Revert "#5015 libecl : Make sure *.UNSMRY is closed properly after data is read"
This reverts commit f1070cdb82.
2019-11-08 11:05:14 +01:00
Magne Sjaastad f1070cdb82 #5015 libecl : Make sure *.UNSMRY is closed properly after data is read 2019-11-08 08:58:33 +01:00
Gaute Lindkvist 7e5d358fa1 Simplified code following further review 2019-10-24 14:13:19 +02:00
Gaute Lindkvist 7bbe505d39 #4762 Fix ecl_grid_reset_actnum in the libecl-team suggested way 2019-10-24 14:13:19 +02:00
Gaute Lindkvist 1255c877d7 Revert "#4762 Fix reset_actnum libecl crash on load"
We will check in a different fix on recommendation by libecl team

This reverts commit 047136e8b8.
2019-10-24 14:13:19 +02:00
Gaute Lindkvist 047136e8b8 #4762 Fix reset_actnum libecl crash on load 2019-09-25 17:49:58 +02:00
Magne Sjaastad 936fab3e32 libecl : Improve comment 2019-06-03 09:11:03 +02:00
Magne Sjaastad dcf33d9289 #4453 Dual Porosity : Use ACTNUM value 3 when creating values from PORV 2019-05-31 14:53:36 +02:00