I'm sorry to post again but this issue is affecting Ubuntu 9.10 32 bit as well.
On a clean virtual machine (so no strange things/configuration happening on it) I just did the following:
sudo apt-get install g++ libavcodec-dev libavformat-dev libswscale-dev
Then I compiled the test app:
g++ ./avcodec_sample.cpp -o av_test -O2 -g -pthread -lavformat -lavcodec -lswscale
And I used against this reference:
(this is an ogv file created by Theora devs)
Again, I had same results as before, corrupted ppm.
Please bear in mind that I've done this with a clean Ubuntu 9.10 32bit host.