sndjvu / workspace

monorepo for SnDjVu's Rust code, website, etc.
https://www.sndjvu.org
Apache License 2.0
6 stars 1 forks source link

Changes to NAVM parsing #30

Open cole-miller opened 1 year ago

cole-miller commented 1 year ago

The following text was added to djvuchanges.txt recently:

The NAVM chunk format specification (section 8.3.3) states that each bookmark encoding starts with a single byte specifying the number of child bookmarks followed by three bytes specifying the bookmark description text length in big-endian order. In order to allow more complex document outlines, this format has been subtly changed: the number of child bookmarks is now encoded as two bytes in small-endian order, and the length of the description text is encoded as two bytes in big-endian order.

This change results in the same encoding as long as there are less than 256 child bookmarks and less that 65536 bytes in the bookmark description text. Since it is unlikely that a description text contains more than 64k characters, djvu files created with the specified NAVM format are read correctly by a program implementing the new NAVM format. However, djvu files created with the new NAVM format and containing bookmark entries with more than 256 children will be read incorrectly by a program that strictly implements the specification.

sndjvu_format will have to deal with this somehow.