From 22e542087f6e6421fcdeb10bb05f7d8c36a9ab9a Mon Sep 17 00:00:00 2001 From: Sergey Alirzaev Date: Wed, 10 Apr 2024 00:13:59 +0200 Subject: [PATCH] Fixed out of bounds transparency cache access (#72850) The problem is caused by points_in_radius() producing negative coordinates. Used https://github.com/CleverRaven/Cataclysm-DDA/pull/72747#issuecomment-2029480223 Fixes https://github.com/CleverRaven/Cataclysm-DDA/issues/70229 Fixes https://github.com/CleverRaven/Cataclysm-DDA/issues/72652 --- src/map_field.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/map_field.cpp b/src/map_field.cpp index 7d57fc2c0d89c..206ce517ce3b2 100644 --- a/src/map_field.cpp +++ b/src/map_field.cpp @@ -655,6 +655,9 @@ static void field_processor_fd_electricity( const tripoint &p, field_entry &cur, bool valid_candidates = false; for( const tripoint &dst : points_in_radius( p, 1 ) ) { + if( !pd.here.inbounds( dst ) ) { + continue; + } // Skip tiles with intense fields const field_type_str_id &field_type = pd.here.get_applicable_electricity_field( dst ); if( field_entry *field = pd.here.get_field( dst, field_type ) ) {