Well, I intend this to make it onto RubyForge one day, but since you have a need Drop this into your RAILS_ROOT/lib and Enjoy! If you want the test/unit/image_size_test.rb, send me an offline email.
Can you send me an offline email (i.e., not through the mailing list or forum) that has both the JPEG file and the actual code you're using? I suspect that there's just a quirk in your JPEG file (I ran into a few oddities myself) that needs a new unit test to uncover. It looks like the end-of-file is being reached without finding the segment that contains size information.