diff --git a/pdf.js b/pdf.js index 814c99f75..48fa004e6 100644 --- a/pdf.js +++ b/pdf.js @@ -2971,6 +2971,7 @@ var Catalog = (function() { var PDFDoc = (function() { function constructor(stream) { + assertWellFormed(stream.length > 0, "stream must have data"); this.stream = stream; this.setup(); } diff --git a/test/test.py b/test/test.py index 367347e88..00b87f786 100644 --- a/test/test.py +++ b/test/test.py @@ -275,7 +275,7 @@ def downloadLinkedPDFs(manifestList): sys.stdout.flush() response = urllib2.urlopen(link) - with open(f, 'w') as out: + with open(f, 'wb') as out: out.write(response.read()) print 'done'