From f5346a16085998963afa08d51a2140d2ac0757d2 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Wed, 22 Apr 2015 17:54:48 +0100 Subject: [PATCH] Continued adding "--skeleton" switch. Check possible overflow immediately. --- re2c/skeleton.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 -- 2.40.0