Overview
SHA1 Hash: | 1527954d87e2e530b81531d90444e43e149cfee6 |
---|---|
Date: | 2007-10-23 04:32:06 |
User: | aku |
Comment: | Added more checks to the RCS parser to detect bogus symbol names and problematic log messages. Added ability to rewind back to the beginning of the last recognized token for a nicer positioned error message. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified tools/cvs2fossil/lib/rcsparser.tcl from [b7e70320c9] to [b3b8dd19e7].
@@ -76,10 +76,14 @@ } proc Symbols {} { RequiredLiteral symbols while {[Ident -> symbol]} { + if {*$} $symbol]} { + Rewind + Bad {symbol name} + } RequiredNumber -> rev Call deftag $symbol $rev } Semicolon return @@ -215,10 +219,15 @@ proc DeltaTexts {} { while {[OptionalNumber -> rev]} { RequiredLiteral log RequiredString -> cmsg + if {[regexp {[\000-\010\013\014\016-\037]} $cmsg]} { + Rewind + Bad "log message for $rev contains at least one control character" + } + RequiredLiteral text RequiredStringRange -> delta Call extend $rev $cmsg $delta } return @@ -385,28 +394,46 @@ # Note: The indices are absolute!, not relative to the start # location. upvar 1 $mv match ::variable mypos ::variable mysize + ::variable mylastpos struct::list assign $match s e #puts "<$s $e> [info level -1]" + set mylastpos $mypos set mypos $e incr mypos log progress 2 rcs $mypos $mysize #puts $mypos/$mysize + return + } + + proc Rewind {} { + ::variable mypos + ::variable mylastpos + + set mypos $mylastpos return } proc Expected {x} { ::variable mydata ::variable mypos set e $mypos ; incr e 30 return -code error -errorcode vc::rcs::parser \ "Expected $x @ '[string range $mydata $mypos $e]...'" + } + + proc Bad {x} { + ::variable mydata + ::variable mypos + set e $mypos ; incr e 30 + return -code error -errorcode vc::rcs::parser \ + "Bad $x @ '[string range $mydata $mypos $e]...'" } # # ## ### ##### ######## ############# ## Setup, callbacks.