Artifacts Associated With Ticket 2380293
Ticket change [3f1d582980] (rid 121396) by duoas on 2008-12-03 00:02:04:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Yep, trying to decode an invalid string causes a segfault (meaning Tcl crashes and burns). To replicate, start up tclsh86 and type: binary decode uuencode foo Hope this helps.
- foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "duoas"
- subsystem initialized to: "12. ByteArray Object"
- title initialized to: "binary decode uuencode foo --> segfault"
- type initialized to: "Bug"
Ticket change [24ea495bb3] (rid 131192) by dkf on 2008-12-03 16:01:07:
- assignee changed to: "patthoyts"
- foundin changed to: "obsolete: 8.6a4"
- priority changed to: "9 Immediate"
Add attachment "uu.patch" [207f271541] (rid 91320) by ferrieux on 2008-12-12 07:11:01.
Ticket change [9c99837878] (rid 96171) by ferrieux on 2008-12-12 07:11:01:
- icomment:
File Added - 304973: uu.patch This is due to an off-by-one length computation yielding -1 in a non-strict case. Knowing nothing of the uuencode algorithm I cannot fix it properly; however, the attached patch fixes the crash by saturating the size to nonnegative values. File Added: uu.patch
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [2af52896b3] (rid 118655) by ferrieux on 2008-12-12 15:47:08:
- icomment:
OK now I know the algorithm. The off-by-one is the visible part of a larger iceberg: the "cut" variable counts missing bytes in the source (base 64) stream, and is wrongly translated 1-to-1 into missing bytes in the decoded stream. So there's a systematic error of factor 4/3 (since a "cut++" should only count as removing 6 bits). However, I believe the very principle of allowing non-strict uudecoding is flawed. Indeed, a "BadUU" byte in the middle is just skipped, but I wonder about the perturbation process that this is modelling. Indeed if random bytes are inserted here and there, only those which are fortunately outside the 32..96 range will be filtered out. So I cannot imagine a practical situation where an uuencoded stream would be decoded non-strictly... So the quick patch is enough to avoid crashes, the only remaining error being truncated results for error-filled inputs. Pat, your feeling ?
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [bf419d8371] (rid 102219) by ferrieux on 2008-12-16 00:15:33:
- icomment:
After a chat with Kevin, only answerer, it appears that non-strictness has an obvious usecase with randomly interspersed whitespace. That was the perturbation process I was after. But it is also clear that any other kind of unexpected character is fishy and should raise an error. Just committed this change: - fix the off-by-one bug that caused crashes or truncation (which is not 4/3 but only of one char at maximum, because it can occur only in the last 4-byte chunk) - redefine the non-strict contract to allow only whitespace as defined by the isspace() function.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [b6a7d1acaf] (rid 125459) by ferrieux on 2008-12-16 00:15:34:
- closedate changed to: "2008-12-15T17:15:34"
- closer changed to: "ferrieux"
- resolution changed to: "Fixed"
- status changed to: "Closed"