[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Re: [PATCH] 3.1.x: Two very wrong, but non-critical bugs
From:       "Carsten Burghardt" <cb () magic-shop ! de>
Date:       2003-07-17 11:16:10
[Download RAW message or body]

Marc Mutz sagte:
> Hi!
>
> Attached patch fixes two things I've come across while cleaning up code
> in kmmsgbase:
>
> 1. The first is just an off-by-one error, combined with flipping the two
> operands of a difference.
>
> In this situation, "mid" points to after the third '?' of an
> encoded-word (ie. to the first char of the encoded-text), while "pos"
> points to the fourth and last '?' of the encoded-word, ie. one after
> the last char of the encoded-text.
>
> Thus, mid - pos - 1 is in general negative (or huge if cast to an
> unsigned), thus left() is a noop-here. But if someone (like me) wants
> to get rid of the *pos=0 hack, then the result crashes.
>
> The correct fix is to use QCString( mid, pos - mid + 1 ) to construct
> "str".
>
> 2. No comment. Just let the original code sink in.
>
> OK to commit?

I have to admit that Iīm generally no friend of asserts in programs with
user interfaces. They donīt tell the user "whops we have a problem" but
let the app crash and most of the people donīt know what to do.

-- 
Carsten Burghardt
PGP: http://www.magic-shop.de/Carsten_Burghardt.asc
_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic