Fix invalid reads in valgrind fate, patch by Daniel Kang <daniel dot d dot
kang at gmail com>, as part of Google's GCI 2010.

Originally committed as revision 26177 to svn://svn.ffmpeg.org/ffmpeg/trunk
