[Bf-committers] seq_hash_render_data() includes undefined results due to out of range bitshift

Campbell Barton ideasman42 at gmail.com
Sat Aug 8 21:01:04 CEST 2015


Thanks for pointing this out, corrected:
https://developer.blender.org/rBf4ba4c6826c8018beaa9fbc820260ca6096d5e22

On Thu, Aug 6, 2015 at 3:43 PM, Chad Fraleigh <chadf at triularity.org> wrote:
> The hash function seq_hash_render_data() in
> blender/source/blender/blenkernel/intern/seqcache.c includes a value
> shifted 32 bits for a 32-bit int.
>
> static unsigned int seq_hash_render_data(const SeqRenderData *a)
> {
>     unsigned int rval = a->rectx + a->recty;
>
> . . .
>
>     rval ^= ((a->scene->r.views_format * 2) + a->view_id) << 32;
>
>     return rval;
> }
>
>
> Compile warning given by VS 2013:
>
> warning C4293: '<<' : shift count negative or too big, undefined
> behavior    .......\blender\source\blender\blenkernel\intern\seqcache.c
>
> That part of the value could be removed (since it may currently be a no-op)
> or changed to a lower shift value (e.g. << 28).
>
>
> -Chad
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



-- 
- Campbell


More information about the Bf-committers mailing list