Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when reading Adobe-obfuscated font when publication identifier is empty #90

Closed
olivierkorner opened this issue May 21, 2021 · 2 comments · Fixed by readium/r2-streamer-swift#213
Labels
bug Something isn't working

Comments

@olivierkorner
Copy link
Contributor

olivierkorner commented May 21, 2021

The Adobe font obfuscation algorithm key is built using the publication identifier.

If it is empty, or just urn:uuid:, the deobfuscation will crash with a "Division by zero" error because the key is empty:
https://github.com/readium/r2-streamer-swift/blob/4067b31f7e88306d66bcef253b5fb538b7b0be68/r2-streamer-swift/Parser/EPUB/Resource%20Transformers/EPUBDeobfuscator.swift#L69

If the key is empty, the deobfuscator should just return the data with transformation.

I have an EPUB to test the issue that I can send privately but not share here.

@mickael-menu
Copy link
Member

mickael-menu commented May 25, 2021

Thanks Olivier, could you send me the EPUB on Slack?

The toolkit should not crash in this case, but the font won't be deobfuscated. Is it an error in the publication that the font is declared obfuscated, or that the publication identifier is missing?

(Note to self: GEF2016.epub)

@mickael-menu mickael-menu added the bug Something isn't working label May 25, 2021
@olivierkorner
Copy link
Contributor Author

olivierkorner commented May 25, 2021

The publication identifier is missing (actually, it is set to urn:uuid:). Note that it looks like the font is not obfuscated in the EPUB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants