Page MenuHome

DNA: Fix ASan warning when reading large uint64_t value
AbandonedPublic

Authored by Julian Eisel (Severin) on Tue, Sep 8, 5:30 PM.

Details

Summary

When casting we would store the member value as double, which if large
enough would be interpreted as negative double. When assigning that
negative value to an unsigned type, ASan would complain:

blender/software/dev/default/src/source/blender/makesdna/intern/dna_genfile.c:884:9: runtime error: -1.07374e+09 is outside the range of representable values of type 'long unsigned int'

(I kept getting this on startup)

Use a large enough unsigned integer type instead to hold the value.

Diff Detail

Repository
rB Blender
Branch
temp-dna-uint64-fix (branched from master)
Build Status
Buildable 10058
Build 10058: arc lint + arc unit

Event Timeline

Julian Eisel (Severin) requested review of this revision.Tue, Sep 8, 5:30 PM
Julian Eisel (Severin) created this revision.
Julian Eisel (Severin) edited the summary of this revision. (Show Details)Tue, Sep 8, 5:32 PM
Julian Eisel (Severin) edited the summary of this revision. (Show Details)
Brecht Van Lommel (brecht) requested changes to this revision.Tue, Sep 8, 7:44 PM

I think that if you cast float to double, it would get rounded now?

This revision now requires changes to proceed.Tue, Sep 8, 7:44 PM