From 26634147dfbb5be9a4046a0d50b3b1d6857ad68d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 3 Apr 2021 22:58:51 +0300 Subject: [PATCH] Guard against hitting the end of the array in get_gl_type --- source/core/datatype.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/core/datatype.cpp b/source/core/datatype.cpp index af7446eb..4dd0b89f 100644 --- a/source/core/datatype.cpp +++ b/source/core/datatype.cpp @@ -88,8 +88,9 @@ namespace GL { GLenum get_gl_type(DataType type) { - const MappedType *ptr = lower_bound(type_map, type_map+type_map_size, type, type_compare); - if(ptr->type!=type) + const MappedType *end = type_map+type_map_size; + const MappedType *ptr = lower_bound(type_map, end, type, type_compare); + if(ptr==end || ptr->type!=type) throw invalid_argument("get_gl_type"); return ptr->gl_type; } -- 2.43.0