[Development] Fixing QRect::width() / height()

Rutledge Shawn Shawn.Rutledge at theqtcompany.com
Tue Mar 15 14:44:12 CET 2016


> On 15 Mar 2016, at 15:43, Marc Mutz <marc.mutz at kdab.com> wrote:
> 
> On Tuesday 15 March 2016 13:08:42 Bo Thorsen wrote:
>> Den 15-03-2016 kl. 14:07 skrev Marc Mutz:
> [...]
>> There is another option that doesn't mean a change of signature: Bound
>> the result. So if the real result is > INT_MAX, return INT_MAX. Same for
>> INT_MIN.
>> 
>> Yes, it's not the correct result, but I completely agree with you that
>> it's a theoretical problem. As long as it's documented in the width() I
>> really don't see the problem with this solution.
> 
> I like the idea to change width() to return a bounded result to avoid UB for 
> old users, but we need a code path that returns the correct result for new 
> users without everyone of them going quint64(1) + r.right() - r.left() by 
> themselves…

Cluttering up the API doesn’t seem nice.  Also not sure what you mean by new users needing such large rectangles… if they do, why don’t they use QRectF?

Or is it about a security hole?



More information about the Development mailing list