From: Ulya Trofimovich Date: Wed, 22 Apr 2015 16:54:48 +0000 (+0100) Subject: Continued adding "--skeleton" switch. X-Git-Tag: 0.15~287 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5346a16085998963afa08d51a2140d2ac0757d2;p=re2c Continued adding "--skeleton" switch. Check possible overflow immediately. --- diff --git a/re2c/skeleton.cc b/re2c/skeleton.cc index 8d9d30f8..cf62ec04 100644 --- a/re2c/skeleton.cc +++ b/re2c/skeleton.cc @@ -112,10 +112,12 @@ uint32_t Skeleton::estimate_size_cover (SkeletonState * s, uint32_t count, uint3 s->path_len = i->first->path_len + 1; } result += n; + if (result > MAX_SIZE) + { + return MAX_SIZE; + } } - return result >= MAX_SIZE - ? MAX_SIZE - : result; + return result; } } else