2008-07-18
2008-07-18 01:42:49 by Martin Stjernholm <mast@lysator.liu.se>
-
fc6ea0a3de7ee41b6bc1c15b058fac2d98b34a72
(8 lines)
(+6/-2)
[
Show
| Annotate
]
Branch: 7.9
Fixed an infinite loop in string_builder_append_integer: Never shift
out all the bits, or else the result is undefined.
Rev: src/stralloc.c:1.230
2:
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
- || $Id: stralloc.c,v 1.229 2008/07/16 00:33:28 mast Exp $
+ || $Id: stralloc.c,v 1.230 2008/07/18 01:42:49 mast Exp $
*/
#include "global.h"
645: Inside #if defined(PIKE_DEBUG)
debug_dump_pike_string(s, 70);
Pike_fatal("String already linked.\n");
}
+
+ if (PIKE_MEM_NOT_DEF_RANGE (s->str, (s->len + 1) << s->size_shift))
+ Pike_fatal ("Got undefined contents in pike string %p.\n", s);
#endif
LOCK_BUCKET(hval);
2694:
else shift = delta;
/* Calculate actual number of digits and initial shift. */
- for (; tmp >> shift; shift += delta, len++)
+ for (; tmp >> shift && shift < SIZEOF_LONGEST * 8; shift += delta, len++)
;
if ((len < min_width) && !(flags & APPEND_LEFT)) {