turn on -Werror and fix resulting errors

Is this tested / are we sure negative length is not used to signal anything relevant?