From fc8c7d357b9fd53940d6ced8aebea04cd4ac6aa5 Mon Sep 17 00:00:00 2001
From: Scott Wheeler <wheeler@kde.org>
Date: Tue, 17 May 2005 20:45:05 +0000
Subject: [PATCH] Do a bounds check before trying to find the mid.

CCMAIL:Felix Hupfeld <hupfeld@zib.de>


git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@415196 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
---
 toolkit/tbytevector.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/toolkit/tbytevector.cpp b/toolkit/tbytevector.cpp
index de4ca6f9..7dff7462 100644
--- a/toolkit/tbytevector.cpp
+++ b/toolkit/tbytevector.cpp
@@ -344,6 +344,9 @@ ByteVector ByteVector::mid(uint index, uint length) const
 {
   ByteVector v;
 
+  if(index > size())
+    return v;
+
   ConstIterator endIt;
 
   if(length < 0xffffffff && length + index < size())
-- 
2.40.0