Tk Library Source Code

View Ticket
Login
Ticket UUID: 821126
Title: uninitialized "$output" in ::base64::decode
Type: Patch Version: None
Submitter: gionco Created on: 2003-10-10 10:30:55
Subsystem: base64 Assigned To: patthoyts
Priority: 7 High Severity:
Status: Closed Last Modified: 2003-10-25 00:47:22
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2003-10-24 17:47:22
Description:
Bug: '$output' is not defined in some situations at the
end of
proc ::base64::decode

Rationale:
Citing base64::decode comments:
     # RFC 2045 says that line breaks and other
characters not part
     # of the Base64 alphabet must be ignored, and that
the decoder
     # can optionally emit a warning or reject the
message.  We opt
     # not to do so, but to just ignore the character.
So, if you pass to base64::decode a totally bad string,
you should
get "" on return, not an error, since for the empty
string we get "".

How to reproduce:
tcl>package require base64
tcl>base64::decode "  "
Error: can't read "output": no such variable

Proposed patch:
At the beginning of base64::decode (base64.tcl, line 281):
set output ""
User Comments: andreas_kupries added on 2003-10-25 00:47:22:
Logged In: YES 
user_id=75003

The fix has been committed to the head, two new tests have 
been added to cover these cases.