libraw: additional data checks backported from 0.15.4 (from lexa)