X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=pdf%2Fgoo%2FGString.cc;h=7653fd06e3e6b1dd2d1ed30f6321dba2e069a22b;hb=refs%2Ftags%2FXPDF_3_00;hp=3bf626aa41e99321d12da3c07b13e11b35daad7e;hpb=2a393c134fe3fe8eb85bf818cb7ad6ae4396322a;p=evince.git diff --git a/pdf/goo/GString.cc b/pdf/goo/GString.cc index 3bf626aa..7653fd06 100644 --- a/pdf/goo/GString.cc +++ b/pdf/goo/GString.cc @@ -4,15 +4,16 @@ // // Simple variable-length string type. // -// Copyright 1996-2002 Glyph & Cog, LLC +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma implementation #endif -#include #include #include #include @@ -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;