Package: djvulibre-bin
Version: 3.5.20-2
Severity: normal
File: /usr/bin/csepdjvu
Tags: patch
csepdjvu manual page states:
The dimensions (width and height) of the background image must be
obtained by rounding up the quotient of the foreground image
dimensions by an integer reduction factor ranging from 1 to 12.
What is more, the DjVu 3 Reference ("10.3 Color chunk data headers")
explicitly permits factor 12.
In reality, csepdjvu allows subsample ratios ranging from 1 to 11.
$ echo 'P1 12 12' > 12x12.pbm
$ for i in `seq 144`; do echo 0 >> 12x12.pbm; done
$ cjb2 12x12.pbm 12x12.djvu
$ ddjvu -format=rle 12x12.djvu 12x12.rle
$ printf 'P6 2 2 255 xxxxxxxxxxxx' > 2x2.ppm
$ cat 12x12.rle 2x2.ppm > ok.sep
$ csepdjvu ok.sep ok.djvu && echo $?
0
$ printf 'P6 1 1 255 xxx' > 1x1.ppm
$ cat 12x12.rle 1x1.ppm > buggy.sep
$ csepdjvu buggy.sep buggy.djvu
*** Background pixmap size does not match foreground
*** (csepdjvu.cpp:1083)
*** 'DJVU::GP<DJVU::GPixmap> read_background(BufferByteStream&, int, int, int&)'
The attached patch fixes this bug.
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (900, 'testing'), (600, 'unstable'), (500, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-3-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=pl_PL (charmap=ISO-8859-2)
Shell: /bin/sh linked to /bin/dash
Versions of packages djvulibre-bin depends on:
ii curl 7.17.1-1 Get a file from an HTTP, HTTPS or
ii libc6 2.7-4 GNU C Library: Shared libraries
ii libdjvulibre15 3.5.20-2 Runtime support for the DjVu image
ii libgcc1 1:4.2.2-4 GCC support library
ii libjpeg62 6b-14 The Independent JPEG Group's JPEG
ii libstdc++6 4.2.2-4 The GNU Standard C++ Library v3
ii libtiff4 3.8.2-7 Tag Image File Format (TIFF) libra
djvulibre-bin recommends no packages.
-- no debconf information
--
Jakub Wilk
diff -ur djvulibre-3.5.20.orig/tools/csepdjvu.cpp djvulibre-3.5.20/tools/csepdjvu.cpp
--- djvulibre-3.5.20.orig/tools/csepdjvu.cpp 2007-12-29 15:38:21.000000000 +0100
+++ djvulibre-3.5.20/tools/csepdjvu.cpp 2007-12-29 15:40:20.000000000 +0100
@@ -1071,7 +1071,7 @@
return 0;
GP<GPixmap> pix = GPixmap::create(bs);
// Check background reduction
- for (bgred=1; bgred<12; bgred++)
+ for (bgred=1; bgred<=12; bgred++)
{
int subw = (w + bgred - 1) / bgred;
int subh = (h + bgred - 1) / bgred;