Better error messages, allow larger-than-needed input when reading.

Review URL: http://codereview.chromium.org/2351002
2 files changed