cras: audio_thread: check if read returns 0

This is speculative fix for a fuzzer crash in
cras_fmt_conv_destroy. It looks like the returned struct
cras_fmt_conv is invalid. When read returns 0, it means
the pipe has been closed. Add a check for this to see if
the crash will be fixed.

BUG=b:68495404
TEST=Play left/right speaker test on YouTube.
"cras_test_client --config_global_remix 2:0.5,0.5,0.5,0.5"
to verify that both channels are mixed.
"cras_test_client --config_global_remix 2:0.1,0.9,0.9,0.1"
to verify that both channels are switched.
"cras_test_client --config_global_remix 2:1,0,0,1"
to verify left/right channels are back to normal.

Change-Id: I9a05a75e1ad6f041eb171c324c32d466adcd84ab
Reviewed-on: https://chromium-review.googlesource.com/756773
Commit-Ready: Wu-Cheng Li <wuchengli@chromium.org>
Tested-by: Wu-Cheng Li <wuchengli@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
1 file changed