1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed a possible out-of-bounds access in cVector::Remove()

This commit is contained in:
Klaus Schmidinger 2015-01-12 12:14:16 +01:00
parent 6e35f47a3e
commit 67fff7f4fc
2 changed files with 4 additions and 1 deletions

View File

@ -8348,3 +8348,4 @@ Video Disk Recorder Revision History
Alberto Reguero). Alberto Reguero).
- Added the functions IndexOf(), InsertUnique(), AppendUnique() and RemoveElement() - Added the functions IndexOf(), InsertUnique(), AppendUnique() and RemoveElement()
to the cVector class (thanks to Stefan Schallenberg). to the cVector class (thanks to Stefan Schallenberg).
- Fixed a possible out-of-bounds access in cVector::Remove().

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __TOOLS_H
@ -575,6 +575,8 @@ public:
} }
virtual void Remove(int Index) virtual void Remove(int Index)
{ {
if (Index < 0)
return; // prevents out-of-bounds access
if (Index < size - 1) if (Index < size - 1)
memmove(&data[Index], &data[Index + 1], (size - Index) * sizeof(T)); memmove(&data[Index], &data[Index + 1], (size - Index) * sizeof(T));
size--; size--;