TaskWindow Wrch bug
nemo (145) 2554 posts |
Another discovery I forgot to write up. All versions of TaskWindow have a bug in their Wrch handling that results in an address exception that does not occur outside the TaskWindow. A comparison that is intended to spot control codes is signed instead of unsigned, which results in negative values of R0 on entry to Wrch being treated as a control code and used as an index into a table. Naturally, very large negative values cause an exception. This doesn’t happen normally.
|
nemo (145) 2554 posts |
I spotted this because I wrote a lovely little function that converts a Unicode into a UTF-8 sequence packed in a single register which can then be output very neatly:
Sadly, that crashes horribly in a TaskWindow when given a packed four byte sequence. |
Jeffrey Lee (213) 6048 posts |
Surely the problem there is that TaskWindow is treating the argument to OS_WriteC as a 32bit value, when in reality only the lower 8 bits are significant? |
nemo (145) 2554 posts |
I have been too tentative, an early AND#&ff would certainly solve it. I was trying to keep TaskWindow from making too many assumptions, but we can’t have TaskWindow thinking &100 is a visible chr and everything else thinking it’s a control code. |