From 9f809839759abadab8c0e6f1cff8acd44cf8ea19 Mon Sep 17 00:00:00 2001 From: Garux Date: Fri, 22 Feb 2019 23:55:20 +0300 Subject: [PATCH] prevent buffer underflow in Vector4ClipPolygon --- libs/math/frustum.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/math/frustum.h b/libs/math/frustum.h index 08990aec..eb635d5e 100644 --- a/libs/math/frustum.h +++ b/libs/math/frustum.h @@ -96,6 +96,8 @@ typedef Vector4* iterator; typedef const Vector4* const_iterator; static std::size_t apply( const_iterator first, const_iterator last, iterator out ){ + if( first == last ) /* prevent buffer underflow in compare( *i ); isn't actually required, for technical correctness only */ + return 0; const_iterator next = first, i = last - 1; iterator tmp( out ); bool b0 = ClipPlane::compare( *i );