Allocate pictures with enough padding for jpeg.
Ensure that jpeg does not use mbs that could require larger padding.
This might have been exploitable.

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