std: Change str::from_bytes to raise a condition on invalid input

As per #4765