Skip to content

Address Sanitizer is throwing an error when a pointer offset is calculated from a null pointer #109

@kavika13

Description

@kavika13

When compiling with zig (which enables address/UB sanitizer by default) and playing back my track, I get an error (at runtime) on this line:

voice = TSF_NULL, v = f->voices, vEnd = v + f->voiceNum;

When I start playback of my track, no voices have been created yet, and the f->voices pointer is null.

Doing an offset from a null pointer I guess is a C rules violation. The error is applying zero offset to null pointer. It sounds pretty pedantic to me, but I guess it's still UB according to the spec, and I guess UB can cause the optimizer to do weird stuff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions