diff options
Diffstat (limited to 'pdf/goo/GString.cc')
-rw-r--r-- | pdf/goo/GString.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/pdf/goo/GString.cc b/pdf/goo/GString.cc index 3bf626a..25e0e05 100644 --- a/pdf/goo/GString.cc +++ b/pdf/goo/GString.cc @@ -8,11 +8,12 @@ // //======================================================================== -#ifdef __GNUC__ +#include <aconf.h> + +#ifdef USE_GCC_PRAGMAS #pragma implementation #endif -#include <aconf.h> #include <stdlib.h> #include <stddef.h> #include <string.h> @@ -203,8 +204,12 @@ GString *GString::del(int i, int n) { int j; if (n > 0) { - for (j = i; j <= length - n; ++j) + if (i + n > length) { + n = length - i; + } + for (j = i; j <= length - n; ++j) { s[j] = s[j + n]; + } resize(length -= n); } return this; |