mozilla/pdf.js — pull request #1899 by benbro (2012-07-13 14:46:38+00:00)
Title: Catch errors when parsing the localization header.

I have a corrupted doc that I can't post here.
I can view the docs in foxitreader and with gs on ubuntu but pdf.js throws an error.
I can view the doc in pdf.js without errors after repairing it with:
gs \
-o repaired.pdf \
-sDEVICE=pdfwrite \
-dPDFSETTINGS=/prepress \
corrupted.pdf

The error when viewing the corrupted doc:

Error: Illegal character in hex string: 
Lexer_getHexString("\x9C")@http://localhost/pdf.js/build/pdf.js:27526 Lexer_getObj()@http://localhost/pdf.js/build/pdf.js:27573 Parser_refill()@http://localhost/pdf.js/build/pdf.js:27074 Parser([object Object],false,null)@http://localhost/pdf.js/build/pdf.js:27068 Linearization([object Object])@http://localhost/pdf.js/build/pdf.js:27635 ()@http://localhost/pdf.js/build/pdf.js:414 ()@http://localhost/pdf.js/build/pdf.js:424 PDFDocument_setup((void 0))@http://localhost/pdf.js/build/pdf.js:483 init([object Object],(void 0))@http://localhost/pdf.js/build/pdf.js:389 PDFDocument([object Object],(void 0))@http://localhost/pdf.js/build/pdf.js:379 wphSetupDoc([object Object])@http://localhost/pdf.js/build/pdf.js:30448 messageHandlerComObjOnMessage([object Object])@http://localhost/pdf.js/build/pdf.js:30398 WorkerTransport_postMessage([object Object])@http://localhost/pdf.js/build/pdf.js:1668 messageHandlerSend("GetDocRequest",[object Object])@http://localhost/pdf.js/build/pdf.js:30430 WorkerTransport_sendData([object ArrayBuffer],[object Object])@http://localhost/pdf.js/build/pdf.js:1803 workerInitialized(null)@http://localhost/pdf.js/build/pdf.js:1227 Promise_then(workerInitialized)@http://localhost/pdf.js/build/pdf.js:1084 getPDFLoad([object ArrayBuffer])@http://localhost/pdf.js/build/pdf.js:1226 getPdfOnreadystatechange([object Event])@http://localhost/pdf.js/build/pdf.js:75