Bug 1064864. Ensure the copying bounds are sane. r=jrmuizel a=sylvestre

This prevents things from going really bad on some drivers.