[cairo] [PATCH 2/4] scaled fonts: Use wide enough type for pointer arithmetic

Adrian Johnson ajohnson at redneon.com
Sat Feb 20 22:49:11 UTC 2016


On 12/02/16 10:19, Simon Richter wrote:
> Hi,
> 
> On 11.02.2016 21:00, Uli Schlachter wrote:
> 
>> Where is this cast back to a pointer that you talk about?
> 
> There are two instances in cairo-scaled-font.c, in lines 480 and 2827.
> Both of them read
> 
>     scaled_font = (cairo_scaled_font_t *) page->cache_entry.hash;
> 
> and the pointer is dereferenced afterwards.
> 
> I agree with your assessment that this should really be a hash value
> only, and using the lower bits might work for that (although the
> bottommost bits are probably all zero due to alignment, so it is not a
> very good hash), but fixing that requires more changes.
> 
>    Simon

Attached is a patch to avoid storing the pointer in the hash value.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-scaled-font-don-t-store-pointer-in-hash-value.patch
Type: text/x-patch
Size: 1753 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20160221/7f41b0bf/attachment.bin>


More information about the cairo mailing list