diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-08-18 11:24:23 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-08-18 11:24:23 (GMT) |
commit | 667535b90dd874c53772570d4bcc498c158452c6 (patch) | |
tree | bf42a1db6ab9708ddf932ce0088f2f32e70aa992 /tools | |
parent | 3b92efc33d10a2042ab874a2812b293de57c54a1 (diff) | |
download | tcl-667535b90dd874c53772570d4bcc498c158452c6.zip tcl-667535b90dd874c53772570d4bcc498c158452c6.tar.gz tcl-667535b90dd874c53772570d4bcc498c158452c6.tar.bz2 |
[Bug 3393714] overflow in toupper delta
Diffstat (limited to 'tools')
-rw-r--r-- | tools/uniParse.tcl | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/uniParse.tcl b/tools/uniParse.tcl index 5608d25..4156c33 100644 --- a/tools/uniParse.tcl +++ b/tools/uniParse.tcl @@ -179,7 +179,7 @@ proc uni::main {} { buildTables $data puts "X = [llength $pMap] Y= [llength $pages] A= [llength $groups]" set size [expr {[llength $pMap] + [llength $pages]*(1<<$shift)}] - puts "shift = 6, space = $size" + puts "shift = $shift, space = $size" puts "title case count = $titleCount" set f [open [file join [lindex $argv 1] tclUniData.c] w] @@ -214,6 +214,9 @@ static CONST unsigned short pageMap\[\] = {" set last [expr {[llength $pMap] - 1}] for {set i 0} {$i <= $last} {incr i} { append line [lindex $pMap $i] + if {[lindex $pMap $i] == 17} { + puts stdout [list ZZZZ: $i] + } if {$i != $last} { append line ", " } @@ -239,6 +242,9 @@ static CONST unsigned char groupMap\[\] = {" set lastj [expr {[llength $page] - 1}] for {set j 0} {$j <= $lastj} {incr j} { append line [lindex $page $j] + if {[lindex $page $j] == 71} { + puts stdout [list YYYY: $i $j] + } if {$j != $lastj || $i != $lasti} { append line ", " } @@ -264,9 +270,9 @@ static CONST unsigned char groupMap\[\] = {" * 101 = sub delta for upper, sub 1 for title * 110 = sub delta for upper, add delta for lower * - * Bits 8-21 Reserved for future use. + * Bits 8-14 Reserved for future use. * - * Bits 22-31 Case delta: delta for case conversions. This should be the + * Bits 15-31 Case delta: delta for case conversions. This should be the * highest field so we can easily sign extend. */ @@ -306,7 +312,10 @@ static CONST int groups\[\] = {" set delta 0 } - set val [expr {($delta << 22) | ($case << 5) | $type}] + set val [expr {($delta << 15) | ($case << 5) | $type}] + if {($val > 0x3fffffff) || ($val < -0x3fffffff)} { + puts stdout [list "XXXXXXXXXXX:" $i $delta $val] + } append line [format "%d" $val] if {$i != $last} { @@ -368,7 +377,7 @@ enum { #define GetCaseType(info) (((info) & 0xE0) >> 5) #define GetCategory(info) ((info) & 0x1F) -#define GetDelta(info) (((info) > 0) ? ((info) >> 22) : (~(~((info)) >> 22))) +#define GetDelta(info) (((info) > 0) ? ((info) >> 15) : (~(~((info)) >> 15))) /* * This macro extracts the information about a character from the |