From 03774c76efee24550f9d9bd279df87fc9038add1 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 1 May 2018 15:47:11 -0600 Subject: [PATCH] mktables: Add guard against Unicode breakage This adds a check that a new Unicode version doesn't create a rational number that is too close to a current rational for our existing floating point precision. Should this happen, we can increase the precision we use. --- charclass_invlists.h | 2 +- lib/unicore/mktables | 8 ++++++++ regcharclass.h | 2 +- uni_keywords.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/charclass_invlists.h b/charclass_invlists.h index 259e73f..8b6ac63 100644 --- a/charclass_invlists.h +++ b/charclass_invlists.h @@ -374323,7 +374323,7 @@ static const U8 WB_table[24][24] = { * be0f129691d479aa38646e4ca0ec1ee576ae7f75b0300a5624a7fa862fa8abba lib/unicore/extracted/DLineBreak.txt * 92449d354d9f6b6f2f97a292ebb59f6344ffdeb83d120d7d23e569c43ba67cd5 lib/unicore/extracted/DNumType.txt * e3a319527153b0c6c0c549b40fc6f3a01a7a0dcd6620784391db25901df3b154 lib/unicore/extracted/DNumValues.txt - * d86a9893f6c106416be89b5f4668a212364638d9ae58b49ec1e05349f3e91c74 lib/unicore/mktables + * f364c5c093e0ea66c2f5059e05855559065dc850e89027730312185ab30169f2 lib/unicore/mktables * 21653d2744fdd071f9ef138c805393901bb9547cf3e777ebf50215a191f986ea lib/unicore/version * 4bb677187a1a64e39d48f2e341b5ecb6c99857e49d7a79cf503bd8a3c709999b regen/charset_translations.pl * 03e51b0f07beebd5da62ab943899aa4934eee1f792fa27c1fb638c33bf4ac6ea regen/mk_PL_charclass.pl diff --git a/lib/unicore/mktables b/lib/unicore/mktables index 6d63c98..7c7dd6b 100644 --- a/lib/unicore/mktables +++ b/lib/unicore/mktables @@ -12956,6 +12956,14 @@ sub register_fraction($) { my $float = eval $rational; $float = sprintf "%.*e", $E_FLOAT_PRECISION, $float; + if ( defined $nv_floating_to_rational{$float} + && $nv_floating_to_rational{$float} ne $rational) + { + die Carp::my_carp_bug("Both '$rational' and" + . " '$nv_floating_to_rational{$float}' evaluate to" + . " the same floating point number." + . " \$E_FLOAT_PRECISION must be increased"); + } $nv_floating_to_rational{$float} = $rational; return; } diff --git a/regcharclass.h b/regcharclass.h index 9747ae5..f7c29e8 100644 --- a/regcharclass.h +++ b/regcharclass.h @@ -1898,7 +1898,7 @@ * be0f129691d479aa38646e4ca0ec1ee576ae7f75b0300a5624a7fa862fa8abba lib/unicore/extracted/DLineBreak.txt * 92449d354d9f6b6f2f97a292ebb59f6344ffdeb83d120d7d23e569c43ba67cd5 lib/unicore/extracted/DNumType.txt * e3a319527153b0c6c0c549b40fc6f3a01a7a0dcd6620784391db25901df3b154 lib/unicore/extracted/DNumValues.txt - * d86a9893f6c106416be89b5f4668a212364638d9ae58b49ec1e05349f3e91c74 lib/unicore/mktables + * f364c5c093e0ea66c2f5059e05855559065dc850e89027730312185ab30169f2 lib/unicore/mktables * 21653d2744fdd071f9ef138c805393901bb9547cf3e777ebf50215a191f986ea lib/unicore/version * 4bb677187a1a64e39d48f2e341b5ecb6c99857e49d7a79cf503bd8a3c709999b regen/charset_translations.pl * 9ea6338945a7d70e5ea4b31ac7856c0b521df96be002e94b4b3b7d31debbf3ab regen/regcharclass.pl diff --git a/uni_keywords.h b/uni_keywords.h index 51676f3..685bddf 100644 --- a/uni_keywords.h +++ b/uni_keywords.h @@ -6834,7 +6834,7 @@ MPH_VALt match_uniprop( const unsigned char * const key, const U16 key_len ) { * be0f129691d479aa38646e4ca0ec1ee576ae7f75b0300a5624a7fa862fa8abba lib/unicore/extracted/DLineBreak.txt * 92449d354d9f6b6f2f97a292ebb59f6344ffdeb83d120d7d23e569c43ba67cd5 lib/unicore/extracted/DNumType.txt * e3a319527153b0c6c0c549b40fc6f3a01a7a0dcd6620784391db25901df3b154 lib/unicore/extracted/DNumValues.txt - * d86a9893f6c106416be89b5f4668a212364638d9ae58b49ec1e05349f3e91c74 lib/unicore/mktables + * f364c5c093e0ea66c2f5059e05855559065dc850e89027730312185ab30169f2 lib/unicore/mktables * 21653d2744fdd071f9ef138c805393901bb9547cf3e777ebf50215a191f986ea lib/unicore/version * 4bb677187a1a64e39d48f2e341b5ecb6c99857e49d7a79cf503bd8a3c709999b regen/charset_translations.pl * 03e51b0f07beebd5da62ab943899aa4934eee1f792fa27c1fb638c33bf4ac6ea regen/mk_PL_charclass.pl -- 1.8.3.1