riff: fix infinite loop

Fixes Ticket2241

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>