From d4baa7dc871fe84cbaeaa05e44b52515b8096ccc Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 1 Dec 2007 11:14:40 +0000 Subject: [PATCH] Fix carries --- libraries/liblutil/utils.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/liblutil/utils.c b/libraries/liblutil/utils.c index 30738c869c..a96fa060cf 100644 --- a/libraries/liblutil/utils.c +++ b/libraries/liblutil/utils.c @@ -638,6 +638,9 @@ scale( int new, lutil_int_decnum *prev, unsigned char *tmp ) part >>= 8; } } + j++; + prev->beg += j; + prev->len -= j; } out = tmp + prev->bufsiz; @@ -648,8 +651,11 @@ scale( int new, lutil_int_decnum *prev, unsigned char *tmp ) out[i] = new & 0xff; new >>= 8; } while ( new ); - prev->beg = prev->bufsiz + i; - prev->len = -i; + i = -i; + if ( prev->len < i ) { + prev->beg = prev->bufsiz - i; + prev->len = i; + } AC_MEMCPY( prev->buf+prev->beg, tmp+prev->beg, prev->len ); } -- 2.39.5