From 67fff7f4fcb83b5e1439bd7b8b3952ae3f423bc3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 12 Jan 2015 12:14:16 +0100 Subject: Fixed a possible out-of-bounds access in cVector::Remove() --- HISTORY | 1 + tools.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY b/HISTORY index 0c5b41bf..889e6cd4 100644 --- a/HISTORY +++ b/HISTORY @@ -8348,3 +8348,4 @@ Video Disk Recorder Revision History Alberto Reguero). - Added the functions IndexOf(), InsertUnique(), AppendUnique() and RemoveElement() to the cVector class (thanks to Stefan Schallenberg). +- Fixed a possible out-of-bounds access in cVector::Remove(). diff --git a/tools.h b/tools.h index ea063232..0a9ecbd4 100644 --- a/tools.h +++ b/tools.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 3.4 2015/01/12 12:03:59 kls Exp $ + * $Id: tools.h 3.5 2015/01/12 12:13:33 kls Exp $ */ #ifndef __TOOLS_H @@ -575,6 +575,8 @@ public: } virtual void Remove(int Index) { + if (Index < 0) + return; // prevents out-of-bounds access if (Index < size - 1) memmove(&data[Index], &data[Index + 1], (size - Index) * sizeof(T)); size--; -- cgit v1.2.3