--- poppler-0.12.4.orig/change +++ poppler-0.12.4/change @@ -0,0 +1,647 @@ + Release 0.12.4 + core: + - Fix Uncover and Fade transition parsing. Bug #26034 + - Fix GfxRadialShading::GfxRadialShading. KDE bug #223359 + - Fix a memory leak in CairoFontEngine + - Use the right matrix for the mask in drawMaskedImage() in CairoOutputDev. Bug #16906 + - Only assume a OC is not visible if it exists and is set to no. Bug #26532 + - Guard agains malloc returning NULL in SplashFTFont + qt4: + - Update requirement to Qt 4.4 + glib: + - Use PDFDoc(wchar_t *, ...) on Windows. Bug #25032 + build system: + - fix typo: "MULTITHREAD" -> "MULTITHREADED" in CMake + Release 0.12.3 + core: + - Be more lenient with /Decode key on images. Bug #17439 + - Correctly initialize fileName in LinkGoToR. Bug #25221 + - Improve the reconstruction of the XRef for broken files + - [Cairo backend] Do not crash on malformed files. Bug #24575 + - Accept Fontname if FontName is not present. KDE bug #217013 + - Make PSOutputDev code a bit more resilient + - Fix writing of null objects. Bug #25465 + - [Cairo backend] Fix crash in some documents. GNOME bug #603934 + - Correctly initialize profileCommands in Gfx constructor + build system: + - Check for openjpeg in the C++ part as it uses bool in the header. Bug #25103 + Release 0.12.2 + core: + - Fix a memory leak when converting to PostScript + - Fix crash when reading a font fails. Bug #24525 + - Make the ICC cache per page instead of global. Bug #24686 + - Do not accept negative interval lengths in the page labels tree. Bug #24721 + - Do not crash on files Aspect of Movie objects are reals instead of integers. Bug #24733 + - Do not render patterns when using CairoImageOutputDev + - Allow Transitions dictionary to be a Ref + - Do not crash if jpeg_start_decompress fails. KDE bug #214317 + glib: + - Fix CVE-2009-3607 + qt4: + - Use '.' in the annotations XML instead of the decimal separator of the current locale + Release 0.12.1 + core: + - Fix compilation on some compilers + - Only initialize the font list once in Windows32/MSVC + - Do not crash on fonts without CharCodeToUnicode. Bug #24036 + - Fix regression due to not setting LC_NUMERIC anymore + - Improve realibility for Streams with broken Length. Bug #6841 + - Write the Info into the trailer dict if there is one. Bug #24091 + - Do not crash when saving files that come from a stream without name. Bug #24090 + - Improve relability of the save function + - Fix the Length value if it was wrong when saving + - Fix includes for those using internal headers + - Rework how hinting is used in the splash backend. It is disabled by default now + - fix constructor of DCTStream when using internal decoder + - Security fixes based xpdf 3.02pl4 + qt4: + - Add the possibility of setting wheter to use or not font hinting + - Add a way for converters to return more exact errors they had when converting + - Check the document is not locked when converting to PS + build system: + - Compile on Cygwin + - Use _WIN32 instead of WIN32. Bug #24259 + - Add the possibility to pass LIB_SUFFIX when using CMake + Release 0.12.0 + core: + - Fix printf format security warnings + - Improve rendering of radial shadings. Bug #20238 + - Better fallback when there's a font type mismatch. Bug #17252 + - Do not crash on attachments without data stream. Bug #10386 + - Fix infinite loop in JBIG2Decoder. Bug #23025 + build system: + - Minimizes pkg-config dependencies for Qt frontends + - Add automake 1.11 support + - Use the newest automake found and not the oldest + - Support AM_SILENT_RULES when using automake 1.11 + utils: + - Add common options to pdftoabw + Release 0.11.3 + core: + - Optimization in the Cairo renderer for some fonts + - Do not apply masks when fill color space mode is csPattern in the Cairo renderer. Bug #22216 + - Check for overflow when parsing integers. Bug #23078 + - Do not save the font file twice for FreeType fonts in the Cairo renderer. Bug #20491 + - Use current fill_opacity when drawing images in the Cairo renderer + - Fix alpha rendering in some files in the Splash renderer. Bug #22143, #22152 + - Implement tiling patterns in the Cairo renderer + - When converting a cm matrix to PS write 4 significant digits for numbers < 1 not 4 decimals. Bug #23332 + - Fix changing of locale, now poppler no longer changes LC_NUMERIC to "C" + - Return PDF version as two integers instead of as a double + Qt4: + - Addition of the Color Management API + - Small fix to documentation + - Fix backwards text search + utils: + - Add the -png flag to pdftoppm to output to PNG + Release 0.11.2 + core: + - Make DecryptStream return sane values for getPos(). Bug #19706 + - Fix bug when printing pdf with multiple page sizes in duplex mode + - Initilize AnnotColot properly when the Array is not correct + - Fix crash on some files with forms. Bug #22485 + - Fix crash in files with invalid embedded files. Bug #22551 + - Improve FileSpec attribute parsing + - Cairo output device improvements. Bugs #10942, #18017, #14160 + - Implement blend modes in cairo backend + - Handle fontType1COT fonts in CairoFontEngine + - Fix generation of PS for some files. Bug #18908 + - Don't use byte_lookup table when color space doesn't support getLine methods. Bug #11027 + - Fix rendering of PDF files with malformed patterns. Bug #22835 + - Add the possibility of disabling font substitution in pdftops. Bug #23030 + - Fix some radio buttons not being detected as such + glib: + - Improvements to the demo + Qt4: + - Improvements to the demo + build system: + - Use gtkbuilder rather than libglade for some tests + utils: + - Fix bug with noCrop parameter in pdftops + Release 0.11.1 + core: + - Support colorizing text in pattern colorspace. Bug #19670 and #19994 + - Add the possibility of forcing no hinting of fonts in the Splash backend + - Support multiple page sizes when converting to PS. Bug #19777 + - Also tokens with leading 00 when parsing the char to unicode map. Bug #22025 + - Improvements of rendering speed in documents using PS transformations a lot. Bug #21562 + - More work on Annotations support + - Use Interpolate flag to decide whether applying image interpolation during rendering. Bug #9860 + - Handle Streams in CMap definitions. Bug #22334 + - Fix some bugs in JBIG2Stream handling + - Fix dashed line in page 1 of bug 20011 + - Fix exit(1) when rendering a file + - Fix pdftops crash on file from KDE bug #174899 + - Fix PS generation in some files. Bug #20420 + - Do not create the GfxColorTransform if the lcms could not be created. Bug #20108 + - Check Mask entries are int before using them, if they are real cast to int and try to use them. Bug #21841 + - Use the correct value when creating the V field for form combo boxes + - Give an error when using level1sep in pdftops without having CMYK support. Bug #22026 + - Don't include lcms.h in GfxState.h + - Fix splashColorModeNComps to correctly include all values for each SplashColorMode + - Add splashClearColor that assigns white to the given colorptr + - Kill support for specifying extension in openTmpFile. Bug #21713 + - Fix "Conditional jump or move depends on uninitialised value". Bug #20011 + glib: + - Add poppler_annot_markup_has_popup + - Hyphenate UTF-8 and UTF-16BE. Bug #21953 + - Use g_strerror instead of strerror. Bug #22095 + - Fix a crash when a destination points to an invalid page + - Improvements to the demo + Qt4: + - Add LinkDestination::destinationName + - Do not try to resolve named destinations for GoTo links pointing to external documents + - Add Page::thumbnail + - Improvements to the demo + - Improvements to the documentation + build system: + - Build fix for MSVC + - Better lcms cmake check comming from kdelibs + - Use pkgconfig for autotools lcms check + - Remove unneeded files from repo. Bug #22094 + Release 0.11.0 + core: + - Add initial support for color management + - Remove case-insensitive matching of filenames in PDFDoc constructor + - Fix extraction of some ActualText content + - More work on Annotations support + - Improve font rendering in Cairo output device + - Fix bug in cairo backend with nested masks + - Fix cairo luminosity smask rendering + - Add optionally text support to Cairo output device + - Add the possibility of setting the datadir on runtime + - Return an error code instead of a boolean when saving + - Make the font scanner more versatile + - Small opimization in documents that use PostScriptFunction transforms + - Minor optimization to Stream handling + - Fix some compile warnings + glib: + - Optional content support + - More work on Annotations support + - Improvements to the demo + - Documentation improvements + - Fix build when compiling with GTK_DISABLE_SINGLE_INCLUDES + Qt4: + - Support URI actions for Table Of Contents items + - Documentation improvements + - Improvements to the demo + - Add a FontIterator for iterating through the fonts of the document + utils: + - Allow the use of cropbox in pdftoppm + - Make pdftohtml output png images when the image stream is not a jpeg + - Make pdftotext accept cropping options like pdftoppm + - Support rendering non-square pixels in pdftoppm + build system: + - Require Cairo 1.8.4 for the Cairo output device + - Require CMake 2.6 when using the CMake build system + - Optionally require libpng for pdftohtml + - Optionally require libcms for color management + Release 0.10.6 + core: + - Fix problems that happen when parsing broken JBIG2 files. + CVE-2009-0799, CVE-2009-0800, CVE-2009-1179, CVE-2009-1180 + CVE-2009-1181, CVE-2009-1182, CVE-2009-1183, CVE-2009-1187, CVE-2009-1188 + - Fix parsing of incorrect border arrays. Bug #19761 + - Fix clip test for fonts. Bug #20950 + - Fix getGlyphAdvance to behave correctly on font size changes. Bug #20769 + - Misc build fixes + build system: + - Fix the Qt4 version we need + Release 0.10.5 + core: + - Read the UF entry if present and prefer it over F in Filespec dictionary + - Fix typo that was making CairoOutputDev crash on some files. Bug #17337 + - Make JBIG2Stream more robust to corrupt input data + - Do not blindly follow loops parsing OutlineItem. Bug #18364 + - Set up the error manager before calling jpeg_create_decompress. Bug #20484 + - Check there is an optional content config before using it. Bug #20587 + - Fix rendering of some PDF with OpenType fonts. Bug #20605 + build system: + - Yet more support for build on windows + - Use AC_CHECK_HEADER to find headers. Bug #20538 + - Check for pkgconfig before using it + - General autotools improvements + Release 0.10.4 + core: + - Fix a memory leak when asking for a document-level JS + - Do not crash in some PDF we do not parse correctly. Bug #19702 + - Fix crash on unexepcted form Opt value. Bug #19790 + utils: + - Fix pdfimages to extract i color components per pixel jpeg images. Bug #19789 + Release 0.10.3 + core: + - Fix a crash on documents with malformed outline. Bug #19024 + - Fix leak on AnnotScreen destructor. Bug #19095 + - Fix wrong PS generation when a large image is in Patterns. Bug #18908 + - Remove BaseFile.h it was never used. Bug #19298 + - Improve document saving + - Fix PS generation of PDF with malformed font Length2 definition + - Fix a leak while parsing annotations + - Fix rendering of some checkboxes + Qt4: + - Fix positioning of Form rects on PDF with cropbox + - Fix positioning of Annotation rects on PDF with cropbox. Bug #18558. + - Small documentation improvements + - Make Document::fonts() work when called more than once. Bug #19405 + build system: + - CMake: look harder for openjpeg + - CMake: update the poppler core headers installation + - Autotools: do not install Function.cc as it's not a header + Qt: + - Fix deserialization of links right coordinate + Release 0.10.2 + core: + - Fix a crash when selecting text in word mode + - Fix a crash in some malformed documents + - Ensure cairo font matrix is invertable. Fixes bugs #18254 and #18429 + - Fix a memory leak + Qt4: + - Fix deserization of links right coordinate + misc: + - Fix build on Solaris 10 + Sun Studio 12 + - Compile with -pedantic + Release 0.10.1 + core: + - Improvements in Optional Content support + - Small fix in Form support + - Fix memory leak in case of error + - Fix potential crash on text search + - Try render documents with invalid indexed color space parameters. Bug #18374 + - Fix crash on text extraction when poppler-data is not installed. Bug #18023 + Qt: + - Fix two memory leaks + Qt4: + - Small documentation improvement + - Fix memory leak in the demo code + Release 0.10.0 + core: + - Fix crashes on PDF using Stitching or Axial Shading painting + - Fix rendering of PDF with Type1 fonts that have more than + one encoding definition per line + - Do not try to save documents that have Encryption as we + do not support that and the user ended with a broken file + - Fix crash on files with OptionalContentGroup but no Name + Qt4: + - Fix the area of the links to be correctly reported on rotated documents + misc: + - Mingw+Msys should work + Release 0.9.3 + core: + - Fix rendering regression on some embedded fonts + - Fix rendering regression of some special fonts + - Fix crash on documents with bogus jpeg data + Qt4: + - The printing flag defaults to true on PSConverter + - Documentation improvement + utils: + - Fix regression that made HmtlOutputDev ignore jpeg images + misc: + - Improve compilation on mingw + Release 0.9.2 + core: + - Fix conversion to PS some files + - Small Form fixes + - Small JS fixes + - Improve memory usage of the cairo renderer + utils: + - Fix mismatched free/delete in pdftohtml + - Fix memory leak in pdftohtml + - Fix crash in pdftohtml + glib: + - Fix a crash in forms demo + misc: + - Compile with -pedantic + Release 0.9.1 + Core: + - Fix crash on some AESv2 encrypted files + - Improve parsing of broken files + glib frontend: + - Minor improvements to the demo application + utils: + - pdftohtml: Generate the outline file in the same place + of the other generated files + Release 0.9.0 + Core: + - Initial JavaScript support + - Annotation improvements + - Improvements in the Arthur based renderer + - Improvements in the Cairo based renderer + - Added a JPEG2000 decoder based on OpenJPEG + - Small fixes in ActualText implementation + - Fix jpeg rendering when not using the libjpeg based decoder + - Movie fixes + - Do not get out of memory on documents that specify huge fonts + - Emulate Adobe Reader behaviour on documents with duplicate keys in Dictionaries + - Forms improvements + Qt4 frontend: + - Annotation improvements + - Forms improvements + - Add the possibility of extracting embedded fonts + - Initial Movie support + - Documentation improvements + - Small improvements in the PS exporter + glib frontend: + - Annotation improvements + - Attachment fixes + utils: + - updated man pages + - Added -listenc to pdfinfo and pdftotext + Release 0.8.7 + Core: + - Fix regression in Form rendering + - Fix memory leak in the cairo backend + Release 0.8.6 + Core: + - Call error() when font loading fails + - Be less strict parsing TTF tables + - Fix crash due to uninitialized variable + Qt 4 frontend: + - Make the paper color setting working as it should + - Make sure to use the correct page width/height for form widgets coordinates + Release 0.8.5 + Core: + - Fix crash on PDF that define a page thumbnail but it's not a Stream + - Fix crash when Annots object is not of the desired type + - Fix crash when obtaining fonts in PDF where XObjects link themselves in loops + - Fix crash on documents with an IRT object + - Saving should work much better now + - Plug some memory leaks in Annotation handling + Utils: + - pdftohtml: Don't crash on documents that specify an invalid named dest for a link + - pdftohtml: Make html output to keep all the spaces with   + - pdftohtml: Improve a bit text layout + - pdftohtml: Make xml output valid xml + Release 0.8.4 + Core: + - Fix leak in ABWOutputDev.cc + - Fix uninitialized variable that broke file saving in some cases + - Use a single global FT_Library in CairoOutputDev. + Fixes some crashes in CairoOutputDev. + Qt 4 frontend: + - Fix saving over existing files + build system: + - Make sure Qt4 moc is used to generate moc files in Qt4 frontend + Release 0.8.3 + Core: + - Fix crash when reading some PDF with annotations + - Fix crash on PDF that reference Optional Content elements that don't exist + - Fix leaks on error conditions + - Do not limit CharCodeToUnicodeString to 8 characters + - Support for surrogates outside the BMP plane + Qt 3 frontend: + - Fix crash when reading PDF with password + - Fix leak when calling scanForFonts + Qt 4 frontend: + - Fix the text() method + Splash renderer: + - Fix compilation with --enable-fixedpoint + Release 0.8.2 + core: + - Fix call broken by a fix introduced in 0.8.1 + Release 0.8.1 + core: + - Do not call FT_Done_Face on a live cairo_font_face_t as it might cause crashes + - Do not take into account Colorspace resource subdictionary for image XObjects + - Downsample 16 bit per component images to 8 bit per component so they render + build system: + - Link to pthread when the system needs it + windows: + - Fix comparing against NULL instead against INVALID_HANDLE_VALUE when calling FindFirstFile + Release 0.8.0 + - Fix caching of members in the glib frontend causing issues with rendering + - Change glib public api to have a correct naming + - Some better error handling on corner cases + - Check the document stream is seekable when opening it + - Build fixes with autotools and with cmake + - Fix infinite recursion on some malformed documents when consulting the fonts + - Fix possible crash when asking for Movie contents + Release 0.7.3 + - Fix regression in Splash renderer + - Fix off-by-one write in Splash + - Plug some minor leaks in Optional Content code + - Improve error handling when creating a document in the glib frontend + Release 0.7.2 + Major Changes: + - Improve font matching not forcing default values onto Fontconfig + - Add preliminary annotations support in the glib frontend + - Initial Movie support in the core + - Make GDK dependency optional in glib bindings + Minor Changes: + - Make the core able to read mime types of embedded files + - Qt4 API for accessing mime types of embedded files + - Handle correctly check state of optional content groups + regarding parents state + - Avoid setting singular CTM matrices on the Cairo backend + - Improved Qt4 API to get character position + - Qt4 api documentation improvements + - Qt4 minor stability fixes + - Proper lib64 Qt detection + - Fix build when compiling without cairo support + Release 0.7.1 + Major Changes: + - Really distribute CMake files as optional build tool + - Initial Optional Content support in core and in the Qt4 frontend + Minor Changes: + - Allow grouped checkboxes to be selected individually + - Qt4 demo program improvements + - Keep cairo and cairo_shape consistent + - Safety checks on Splash renderer so that it does not draw outside the allocated bitmap + - Do not try to display bitmaps of invalid size + - Fix building with exceptions + - Improvements for building with MSVC and CMake + Release 0.7.0 + - Saving support + - Partial annotation support + - Forms improvements + - Add support for ActualText entries + - Display characters outside of unicode BMP with TT font + - CJK rendering fixes + - Implement Adobe Glyph Naming convention for fonts + - CMake as optional build tool + - Better font scaling for non embedded fonts + - Preserve PDF page labels when we output as postscript + Release 0.6.4 + Qt4 frontend: + - Fix crash on links that point to a non existant page + - Make Document::renderHints return the correct render hints + - Fix infinite loop when parsing LineAnnotation + core: + - Fix crash in the Splash renderer when T3 fonts are badly defined + - Draw underlined Links correctly + utils: + - Fix two use after free bugs in HtmlOutputDev.cc + build system: + - Fix build on mingw32 + tests: + - Distribute the glade file of pdf-inspector + Release 0.6.3 + core: + - Fix crash in extra debug code + glib frontend: + - Make sure passwords are passed correctly to poppler core + Qt frontend: + - Fix crash on documents that specify an empty date + build system: + - Disable gtk tests if the user disabled glib frontend + Release 0.6.2 + poppler core: + - Fix CVE-2007-4352, CVE-2007-5392 and CVE-2007-5393 + - Fix a crash on documents with wrong CCITTFaxStream + - Fix a crash in the Cairo renderer with invalid embedded fonts + - Fix a crash with invalid TrueType fonts + - Check if font is inside the clip area before rendering + it to a temporary bitmap in the Splash renderer. Fixes crashes on + incorrect documents + - Do not use exit(1) on DCTStream errors + - Detect form fields at any depth level + - Do not generate appearance stream for radio buttons that are not active + - mingw fixes + build system: + - Require fontconfig >= 2.0 + - builddir != srcdir fixes + Qt4 frontend: + - Improved documentation + misc: + - Fix FSF address + Release 0.6.1 + poppler core: + - Fix printing with different x and y scale + - Fix crash when Form Fields array contains references to non existent objects + - Fix crash in CairoOutputDev::drawMaskedImage + - Fix embedded file description not working on some cases + Qt4 frontend: + - Fix printing issue + - Avoid double free + - Fix memory leak when dealing with embedded files + glib frontend: + - Fix build with --disable-cairo-output + - Do not return unknown field type for signature form fields + build system: + - Support automake-1.10 + - More compatible sh code in qt.m4 + utils: + - Fix build on Sun Studio compiler + Release 0.6 + - CairoOutputDev fixes + - Allow pdftoppm to read/write from stdin/stdout + - API work on Qt4 frontend + - Fix pdfimages produces inverted image for black & white image + - Fix error on the NFKC text matching routine + - Add support for word and line selections + - Do not enforce %%EOF at the end of file + - Pad zeroes instead of aborting when rendering 1-bit images + and the stream is too short + - Update glib bindings documentation + Release 0.5.91 + - Various memory leaks fixed + - Compile with --enable-fixedpoint. Bug #11110 + - Header cleanup + - Remove dependency on debugxml. Bug #11187 + - Allow access to document metadata in glib and qt4 frontends + - Several glib API frontend improvements + - Fix crash on accessing embedded files + - Build on Sun Force compiler + - Render '*' instead of the actual content in password form fields + - Fix pdftohtml complex output. Bug #9746 and #11610 + - Windows build fixes + - Improve Japanese font support. Bug #11413 + - Do not exit the program on files that confuse libjpeg + - Update required cairo version to 1.4 + - Fix CVE-2007-3387 + Release 0.5.9 + - Merge xpdf 3.02 changes + - Qt4 frontend is not marked anymore as unstable + - Support for Sound objects + - Support for Opening/Closing page actions + - Support for page duration + - Improve PS Tokenizer performance thanks to Scott Turner + - Various speed ups by Krzysztof Kowalczyk + - Beginning of Interactive Form support by Julien Rebetez + - xpdfrc is no longer used for anything + - Add AbiWord output device and pdftoabw program by Jauco Noordzij + - Fix security issue MOAB-06-01-2007 + - Lots of bugs fixed + Release 0.5.4 + - Automatically read in CJK encoding files if they're + installed (#2984, #7105, #7093). This works with the new + poppler-data package. + - Speed ups by Krzysztof Kowalczyk + - Patch from Dom Lachowicz to let the utils take input on stdin. + - Bugs fixed (#8182, #4649, #7906, #8048, #7113, #4515, #3948, + - #7924, #7780, #7646, #6948, #7788, #7661, #7005) + Release 0.5.3 + - Add poppler as a private requires of poppler-glib. + - Allow CairoFont creation to fail more gracefully + - Back out the rest of krh's type3 font work. + - Revert splashModeRGB8 changes. + - Add missing poppler-annotation-helper.h. + Release 0.5.2 + - Much improved Qt bindings + - Cairo backend now supports masked images + - Patches from Kouhei Sutou to make glib bindings more + language binding friendly + - Search now works with ligatures + - The glib bindings now has an entry point to render to a cairo_t. + - GCC 4.1 and MSVC compilation fixes. + - Memory leaks plugged: #6908, #6947, #6765, #6764, #6187 + - Misc bug fixes: #6984, #6896, #6913, #6926, #4481, #5951, + - #6551, #6500, #6492, #6454, #6079, #6167. + Release 0.5.1 + - Support for embedded files. + - Handle 0-width lines correctly. + - Avoid external file use when opening fonts. + - Only use vector fonts returned from fontconfig + - Fix scaled 1x1 pixmaps use for drawing lines + - drawSoftMaskedImage support in cairo backend. + - Misc bug fixes: #5922, #5946, #5749, #5952, #4030, #5420. + Release 0.5.0 + - Font matching code for non embedded fonts now use fontconfig + instead of hard coded list of fonts. + - Merge in Xpdf 3.01 changes. + - Add command line tools from Xpdf. + - Make install of Xpdf header files ./configure'able. + Release 0.4.0 + - Real text selection. + - API breakage in glib wrapper: dropping dest_x and dest_y + arguments from poppler_page_render_to_pixbuf + Release 0.3.3 + - New glib API to get document font information + - More document properties available as glib properties (Emil + Soleyman-Zomalan, #3359) + - Optimize color conversion for images. + - Support for constant opacity. + - Fix problems with pkg-config files. + - Bugs fixes: #3491, #2911, #3362, #3340, #3265, #3239, #3396. + Release 0.3.2 + - New API to get poppler version and backend type. + - Various font fixes from Albert Astals Cid. + - Update to cairo 0.5.0 API, including better font support. + - Meta data for the glib binding. + Release 0.3.1 + - Add qt/poppler-private.h to SOURCES + - Jeff's path to use zlib instead of builtin decompression. + - Bug fixes: #2934, segfault on invalid links, #3114 + Release 0.3.0 + - First cut at qt wrapper, including a getText() method for + getting text from a page. + - More glib functionality: meta data, set page orientation, + print to PS + - Performance fixes for glib cairo + - Bug fixes + Release 0.2.0 + - Add glib wrapper for poppler, which will use cairo rendering + if available + - Support for page labels + - configure and build fixes. + Release 0.1.2 + - cairo optimizations and fixes from Jeff Muizelaar + - Bump cairo requirement to 0.4 + - Make cairo and gtk checks fail gracefully + Release 0.1.1 + - Fix issues with installed header files including config.h + - Fix a couple of typos in pkg-config files + - Install splash and cairo header files when necessary + Release 0.1 - no date yet + - First release + - More NEWS here + --- poppler-0.12.4.orig/debian/libpoppler-qt-dev.install +++ poppler-0.12.4/debian/libpoppler-qt-dev.install @@ -0,0 +1,4 @@ +debian/tmp/usr/include/poppler/qt3 +debian/tmp/usr/lib/libpoppler-qt.a +debian/tmp/usr/lib/libpoppler-qt.so +debian/tmp/usr/lib/pkgconfig/poppler-qt.pc --- poppler-0.12.4.orig/debian/changelog +++ poppler-0.12.4/debian/changelog @@ -0,0 +1,758 @@ +poppler (0.12.4-0ubuntu5.3) lucid-security; urgency=low + + * SECURITY UPDATE: invalid memory access issues + - debian/patches/CVE-2013-1788.patch: add checks in poppler/Function.cc, + poppler/Stream.cc, splash/Splash.cc. + - CVE-2013-1788 + * SECURITY UPDATE: uninitialized memory read + - debian/patches/CVE-2013-1790.patch: properly handle refLine in + poppler/Stream.cc. + - CVE-2013-1790 + + -- Marc Deslauriers Wed, 27 Mar 2013 14:05:52 -0400 + +poppler (0.12.4-0ubuntu5.2) lucid-proposed; urgency=low + + * debian/patches/12_set-font-weight-medium.patch: added + - set FC_WEIGHT_MEDIUM when the font name contains "Medium", LP: #769827 + + -- Nobuto MURATA Tue, 26 Apr 2011 09:58:25 +0900 + +poppler (0.12.4-0ubuntu5.1) lucid-security; urgency=low + + * SECURITY UPDATE: possible arbitrary code execution via malformed PDF + - debian/patches/CVE-2010-3702.patch: properly initialize parser in + poppler/Gfx.cc. + - CVE-2010-3702 + * SECURITY UPDATE: possible arbitrary code execution via malformed PDF + - debian/patches/CVE-2010-3703.patch: Properly initialize stack in + poppler/Function.cc. + - CVE-2010-3703 + * SECURITY UPDATE: possible arbitrary code execution via malformed PDF + - debian/patches/CVE-2010-3704.patch: make sure code isn't < 0 in + fofi/FoFiType1.cc. + - CVE-2010-3704 + + -- Marc Deslauriers Wed, 13 Oct 2010 15:50:31 -0400 + +poppler (0.12.4-0ubuntu5) lucid-proposed; urgency=low + + * debian/patches/11_column_selection.patch: + - backport from upstream git commit to fix wrong selection in pdf when + containing tables, long text, broken flow and so on. + (fixing most of known issues with selection in pdf) (LP: #33288) + + -- Didier Roche Mon, 19 Apr 2010 16:41:30 +0200 + +poppler (0.12.4-0ubuntu4) lucid; urgency=low + + * debian/patches/backport-rotation-scaling.patch: + - git change to fix rotated images scaling + + -- Sebastien Bacher Thu, 01 Apr 2010 16:58:57 +0200 + +poppler (0.12.4-0ubuntu3) lucid; urgency=low + + * Updated the patch to work without having to run autotools at buildtime + + [ Josh Holland ] + * Add backport-anti-alias.patch: Fix anti aliasing (fixed in upstream git) + (LP: #248355) + + -- Sebastien Bacher Wed, 31 Mar 2010 18:10:37 +0200 + +poppler (0.12.4-0ubuntu2) lucid; urgency=low + + * Add psname-escape-backslash.patch: Don't use '\' character in PostScript + names. Patch backported from 0.13.1. (LP: #404214) + + -- Martin Pitt Fri, 19 Mar 2010 13:51:55 +0100 + +poppler (0.12.4-0ubuntu1) lucid; urgency=low + + * New upstream version: + - Fix Uncover and Fade transition parsing. Bug #26034 + - Fix GfxRadialShading::GfxRadialShading. KDE bug #223359 + - Fix a memory leak in CairoFontEngine + - Use the right matrix for the mask in drawMaskedImage() in CairoOutputDev. + Bug #16906 + - Only assume a OC is not visible if it exists and is set to no. Bug #26532 + - Guard agains malloc returning NULL in SplashFTFont + * debian/patches/01_git_change_fix_matrix_use.patch: + - the change is in the new version + + -- Sebastien Bacher Thu, 25 Feb 2010 16:32:49 +0100 + +poppler (0.12.3-0ubuntu1) lucid; urgency=low + + * New upstream version: + - [Cairo backend] Do not crash on malformed files. Bug #24575 (lp: #430887) + - [Cairo backend] Fix crash in some documents. GNOME bug #603934 ( + lp: #436197) + * debian/patches/01_git_change_fix_matrix_use.patch: + - git change to fix a wrong matrix use leading to rendering issues + (lp: #252552) + + -- Sebastien Bacher Fri, 29 Jan 2010 12:17:57 +0100 + +poppler (0.12.2-2.1ubuntu3) lucid; urgency=low + + * debian/patches/10_fix-a4-page-shift-on-brother-ps-printers.patch: + Fixed page shifts when printing on A4 paper with Brother PostScript + printers, by applying the changes suggested in Poppler upstream bug + 18711, comment #30 (LP: #293832). + + -- Till Kamppeter Thu, 17 Dec 2009 23:39:23 +0100 + +poppler (0.12.2-2.1ubuntu2) lucid; urgency=low + + * Rebuild due to binary incompatible qt4-x11 change after 4.6 Beta release + * Bump qt4-x11 build-dep version requirements to 4.6.0 to prevent additional + misbuilds on ports (powerpc and ia64) + + -- Scott Kitterman Mon, 14 Dec 2009 15:56:34 -0500 + +poppler (0.12.2-2.1ubuntu1) lucid; urgency=low + + * Sync on Debian + * debian/control, debian/rules: + - don't use openjpeg it's in universe + - don't use libglade the new version uses gtkbuilder + + -- Sebastien Bacher Wed, 25 Nov 2009 17:13:37 +0100 + +poppler (0.12.0-2.1) unstable; urgency=low + + * Non-maintainer upload. + * Include fofi/*.h in /usr/include/poppler/fofi. Closes: #553445. + + -- Matt Kraai Tue, 10 Nov 2009 19:51:32 -0800 + +poppler (0.12.0-2) unstable; urgency=low + + * copyright: add complete list of copyright holders. + * Upload to unstable. Hold on to your pants. + + -- Josselin Mouette Sat, 17 Oct 2009 10:48:03 +0200 + +poppler (0.12.0-1) experimental; urgency=low + + * New upstream release. Closes: #530731. + * Rename libpoppler4 to libpoppler5. + * Bump shlibs versions. + + -- Josselin Mouette Thu, 24 Sep 2009 16:39:17 +0200 + +poppler (0.10.6-1) unstable; urgency=critical + + * Fix section for the debug package. + * New upstream release. + + Fix problems that happen when parsing broken JBIG2 files. + CVE-2009-0799, CVE-2009-0800, CVE-2009-1179, CVE-2009-1180, + CVE-2009-1181, CVE-2009-1182, CVE-2009-1183, CVE-2009-1187, + CVE-2009-1188. + * Bump libqt4 requirement. + * 10_jpxstream_int_crash.patch: removed, upstream has merged a + different fix quite a while ago. + * Standards version is 3.8.1. + + -- Josselin Mouette Wed, 01 Apr 2009 18:30:04 +0200 + +poppler (0.10.5-1) unstable; urgency=low + + [ Pino Toscano ] + * New upstream release, no API nor ABI changes. + + Fixes crash when rendering documents with optional content. + (Closes: #519494) + * Remove lintian override for poppler-dbg, which is no more needed with + lintian >= 2.2.1. + + -- Josselin Mouette Wed, 01 Apr 2009 15:19:53 +0200 + +poppler (0.10.4-3) unstable; urgency=low + + * Revert previous upload, now openjpeg was built successfully on + alpha. + * Build-depend on libglib2.0-doc to ensure proper xrefs. + + -- Josselin Mouette Tue, 10 Mar 2009 12:03:06 +0100 + +poppler (0.10.4-2) unstable; urgency=low + + * Don’t require openjpeg on alpha, since it doesn’t build there. + + -- Josselin Mouette Sun, 08 Mar 2009 03:33:50 +0100 + +poppler (0.10.4-1) unstable; urgency=low + + [ Pino Toscano ] + * New upstream stable release, with ABI and API changes wrt poppler 0.8. + - Rename libpoppler3 to libpoppler4, libpoppler-glib3 to libpoppler-glib4; + libpoppler-qt2 and libpoppler-qt4-3 are not renamed; update control, + DEB_DH_MAKESHLIBS_ARGS_* in rules, and rename install files. + - Add shlib version for libpoppler-qt4-3. + - Drop patches 60_manpages-cfg-flag.patch, 61_manpages-hyphens.patch, and + 62_pdftops-mandatory-arg.patch, merged upstream. + * Build-dep on libopenjpeg-dev for better JPEG2000 reading. + + [ Josselin Mouette ] + * Build-depend explicitly on libjpeg-dev, libfreetype6-dev and + libxml2-dev. + * Bump requirement on libqt4-dev. + + -- Josselin Mouette Fri, 06 Mar 2009 12:54:09 +0100 + +poppler (0.8.7-1) unstable; urgency=low + + * Bump up Standards-Version to 3.8.0. + * New patch, 61_manpages-hyphens, fixes escaping of hyphens in man pages; + FreeDesktop #17225. + * New patch, 62_pdftops-mandatory-arg, fixes synopsis of pdftops in man page + to clarify that a PDF file is required in all cases; FreeDesktop #17226; + closes: #491816. + * Build-dep on cdbs (>= 0.4.52) and add a lintian override with rationale + for the following lintian warning: + W: poppler-dbg: dbg-package-missing-depends poppler + * Add xrefs and CVE for #489756 in 0.8.5-1 as I didn't merge the 0.8.4-1.1 + NMU. + * New upstream release; no API change, bug fixes. + + -- Loic Minier Wed, 20 Aug 2008 17:36:12 +0200 + +poppler (0.8.6-1) unstable; urgency=low + + * Fix /usr/share/gtk-doc/html/poppler symlink to point at + /usr/share/doc/libpoppler-glib-dev/html/poppler instead of + /usr/share/doc/libpoppler-glib-dev/html; LP: #226677. + * New upstream stable release; bug fixes, no API change. + * New patch, 60_manpages-cfg-flag, drop unimplemented -cfg flag from man + pages; FreeDesktop #17222; closes: #461961. + * Rename patch 001_jpxstream_int_crash to 10_jpxstream_int_crash as we don't + have that many patches; also add upstream bug id (FreeDesktop #5667) and + refresh to apply cleanly. + * Build-dep on pkg-config >= 0.18 to make sure -lpoppler is only in + poppler-qt's Libs.private (it already is though); closes: #360595. + + -- Loic Minier Fri, 01 Aug 2008 15:04:05 +0200 + +poppler (0.8.5-1) unstable; urgency=low + + * New upstream release; no API changes, misc fixes. + - Initializes pageWidgets in Page.cc, otherwise it can be a rubbish + pointer as Annots is not a valid object; upstream commit + fd0bf8b05cb155e2f29df31fa01964b12e710b89; CVE-2008-2950; + closes: #489756. + + -- Loic Minier Wed, 30 Jul 2008 14:52:42 +0200 + +poppler (0.8.4-1) unstable; urgency=low + + * New upstream release; no API change. + - Fixes crash when reloading PDFs; GNOME #536482; closes: 484160. + + -- Loic Minier Mon, 30 Jun 2008 10:44:16 +0200 + +poppler (0.8.3-1) unstable; urgency=low + + * New upstream release. Closes: #487214. + + Fix crasher with some PDF files. Closes: #484224. + + -- Josselin Mouette Wed, 25 Jun 2008 16:40:39 +0200 + +poppler (0.8.2-2) unstable; urgency=low + + * Upload to unstable. + * Set myself as Maintainer instead of Uploader, taking over from Ondřej Surý + but I wish we move to an official team; closes: #481323. + + -- Loic Minier Thu, 15 May 2008 12:33:18 +0200 + +poppler (0.8.2-1) experimental; urgency=low + + * New upstream releases. + - Drop patch 006_pthreads_ldflags, upstream now calls ACX_PTHREAD() in + configure.ac which does the right thing. + - Drop patch 102_embedded-font-fixes, merged upstream. + + -- Loic Minier Sun, 11 May 2008 01:02:22 +0200 + +poppler (0.8.0-1) experimental; urgency=low + + * Bump libcairo2-dev build-dep and dep to >= 1.4; thanks + Marc 'HE' Brockschmidt. + * New upstream stable release, with ABI and API changes; closes: #476323. + - Rename libpoppler2 to libpoppler3, libpoppler-glib2 to libpoppler-glib3, + and libpoppler-qt4-2 to libpoppler-qt4-3; NB: libpoppler-qt2 not + renamed; update control, DEB_DH_MAKESHLIBS_ARGS_* in rules, rename + install files. + - Drop shlib version except for libpoppler-qt2. + - Update patch 006_pthreads_ldflags for the version-info changes in + poppler/Makefile.am. + - Force usage of qt4's moc via a PATH setting; export PATH. + * Let libpoppler-glib-dev depend on libglib2.0-dev >= 2.6 for consistency + with build-deps. + * New patch, 102_embedded-font-fixes; protects the methods of the Object + class to be more robust and prevent things like CVE-2008-1693; see also + FreeDesktop/Poppler #11392; taken from the Ubuntu package; + closes: #476842. + * Add a poppler-dbg package; closes: #408403. + - Bump up cdbs build-dep to >= 0.4.51 for -dbg handling fixes. + - Add poppler-dbg to control. + + -- Loic Minier Mon, 17 Mar 2008 21:00:13 +0100 + +poppler (0.6.4-1) unstable; urgency=medium + + * Add ${shlibs:Depends} to libpoppler-glib-dev, libpoppler-dev, + libpoppler-qt-dev, libpoppler-qt4-dev. + * Add ${misc:Depends}. + * Cleanups. + * New upstream releases; no API change; bug fixes; closes: #459342. + * Fix copyright information to use version 2 of the GPL (instead of version 2 + or later); thanks Timo Jyrinki for the patch; closes: #453865. + * Urgency medium for RC bug fix. + * List pdftohtml in poppler-utils' description; closes: #464439. + * Drop libpoppler-qt-dev dependency from libpoppler-qt4-dev; thanks + Pino Toscano; closes: #459922. + * Bump up Standards-Version to 3.7.3. + + -- Loic Minier Fri, 18 Jan 2008 13:35:06 +0100 + +poppler (0.6.2-1) unstable; urgency=low + + * New upstream version. (Closes: #447992) + * Dependency on xpdfrc was removed on 2007-02-25 (Closes: #347789, #440936) + * Changes since 0.6.1: + - Fix CVE-2007-4352, CVE-2007-5392 and CVE-2007-5393 (Closes: #450628) + - Fix a crash on documents with wrong CCITTFaxStream + - Fix a crash in the Cairo renderer with invalid embedded fonts + - Fix a crash with invalid TrueType fonts + - Check if font is inside the clip area before rendering + it to a temporary bitmap in the Splash renderer. Fixes crashes on + incorrect documents + - Do not use exit(1) on DCTStream errors + - Detect form fields at any depth level + - Do not generate appearance stream for radio buttons that are not active + + -- Ondřej Surý Wed, 14 Nov 2007 11:20:07 +0100 + +poppler (0.6.1-2) unstable; urgency=low + + * Upload to unstable. + + -- Ondřej Surý Tue, 06 Nov 2007 09:07:10 +0100 + +poppler (0.6.1-1) experimental; urgency=low + + * New upstream version. + * Changes since 0.6.0: + - poppler core: + + Fix printing with different x and y scale + + Fix crash when Form Fields array contains references to non + existent objects + + Fix crash in CairoOutputDev::drawMaskedImage() + + Fix embedded file description not working on some cases + - Qt4 frontend: + + Fix printing issue + + Avoid double free + + Fix memory leak when dealing with embedded files + - glib frontend: + + Fix build with --disable-cairo-output + + Do not return unknown field type for signature form fields + - build system: + + Support automake-1.10 + + More compatible sh code in qt.m4 + - utils: + + Fix build on Sun Studio compiler + + -- Ondřej Surý Thu, 25 Oct 2007 11:33:04 +0200 + +poppler (0.6-1) experimental; urgency=low + + * New upstream release. (Closes: #429700) + - merged changes from Ubuntu, courtesy of Sebastien Bacher + - Fix security issue MOAB-06-01-2007 + - Fix security issue CVE-2007-3387 + - Fix security issue CVE-2007-5049 (Closes: #443903) + * debian/watch: + - update (Closes: #441012) + * debian/control, debian/libpoppler2.install, debian/libpoppler-glib2.install, + debian/libpoppler-qt2.install, debian/libpoppler-qt4-2.install, + debian/rules: + - updated for soname change + * debian/libpoppler-glib-dev.install: + - install new test-poppler-glib + * debian/patches/002_CVE-2006-0301.patch: + - dropped, deprecated by the upstream changes + * debian/patches/003_glib-2.0-configure.patch: + * debian/patches/004_CVE-2007-0104.patch: + * debian/patches/005_fix_inverted_text_from_bug_8944.patch: + - dropped, fixed with the new version + * debian/patches/006_pthreads_ldflags.patch: + - updated + + -- Ondřej Surý Thu, 27 Sep 2007 09:03:33 +0200 + +poppler (0.5.4-6) unstable; urgency=low + + * Conflict with old library names from experimental. (Closes: #426023) + + -- Ondřej Surý Wed, 30 May 2007 08:42:32 +0200 + +poppler (0.5.4-5) unstable; urgency=low + + * Add missing poppler/poppler-link-qt3.h header to libpoppler-qt-dev; thanks + Sune Vuorela; closes: #425486. + * Let libpoppler-qt4-dev depend on libpoppler-qt-dev since some of its + headers require poppler-page-transition.h which is clearly from the Qt + bindings; thanks Sune Vuorela; closes: #425540. + * Wrap build-deps and deps. + * Drop useless debian/*.dirs. + * Misc cleanups. + * Build-dep on autotools-dev and drop bogus lintian overrides. + + -- Loic Minier Thu, 24 May 2007 23:09:23 +0200 + +poppler (0.5.4-4) unstable; urgency=low + + * The "Augean Stables" release. + * 0.5.x branch fixes all kind of displaying errors + Closes: #372169, #235360, #331380, #332426, #336616 + Closes: #402647, #369164, #413953, #343654 + * Add versioned conflict to pdftohtml (Closes: #393169) + * We dropped .la files some time ago, libjpeg62-dev dependency not + needed now (Closes: #413112) + * Crash fixed in 0.5.4 (Closes: #418638) + * [control.in]: dropped some time ago (Closes: #407818) + * NMU 0.5.4-5.1 merged as 004_CVE-2007-0104.patch (Closes: #407810) + * 0.5.x uploaded to unstable (Closes: #352522) + * qt4 libraries are now part of build (Closes: #414643) + * No longer depends on poppler-data (Closes: #389753) + * [debian/patches/006_pthreads_ldflags.patch]: + + Add -lpthread to poppler/Makefile.am (Closes: #399275) + + -- Ondřej Surý Wed, 16 May 2007 10:45:39 +0200 + +poppler (0.5.4-3) unstable; urgency=low + + * Upload to unstable. + * Enable Cairo output again. + * Enable gtk-doc build. + * Add lintian override for outdated-autotools-helper-files (we use CDBS). + * Change shared library packages names according to Library Packaging Guide. + * Change ${Source-Version} to ${binary:Version} to allow binNMU + * Drop (= ${Source-Version}) dependency in glib, qt3, qt4 libraries; we are + adding that from debian/rules + * Merge changes from Ubuntu: + + Enable Qt4 library build (but change name to libpoppler-qt4-1). + + [debian/patches/004_CVE-2007-0104.patch]: + - Limit recursion depth of the parsing tree to 100 to avoid infinite loop + with crafted documents. + - Patch taken from koffice security update (which has a copy of xpdf + sources). + + [debian/patches/005_fix_inverted_text_from_bug_8944.patch]: + - fixes "text is inverted in some PDFs" + + -- Ondřej Surý Wed, 16 May 2007 08:26:47 +0200 + +poppler (0.5.4-2) experimental; urgency=low + + * [debian/control]: poppler-data is non-free, do not depend on it (Closes: #389753) + + -- Ondřej Surý Mon, 2 Oct 2006 14:41:58 +0200 + +poppler (0.5.4-1) experimental; urgency=low + + * New upstrem release. + * [debian/control.in]: remove file and add all pkg-freedesktop people + to Uploaders: field + * [debian/control]: Add dependency on poppler-data package. + * [debian/patches/03_glib-2.0-configure.patch]: fix broken configure.ac + + -- Ondřej Surý Fri, 22 Sep 2006 16:49:17 +0200 + +poppler (0.5.3-1) experimental; urgency=low + + * New upstream release. + * debian/lib{poppler,poppler-glib,poppler-qt}-dev.install: + Stop shipping /usr/lib/*.la in libpoppler*-dev. + + -- Ondřej Surý Wed, 31 May 2006 17:19:34 +0200 + +poppler (0.5.2-1) experimental; urgency=low + + * New upstream release. + * Remove patches adopted upstream: + debian/patches/000_incorrect_define_fix.patch + debian/patches/000_splash_build_fix.patch + + -- Ondřej Surý Tue, 23 May 2006 20:21:30 +0200 + +poppler (0.5.1-1) experimental; urgency=low + + * Merge back changes from Ubuntu. + * Upload to experimental (Closes: 352522) + + -- Ondřej Surý Tue, 18 Apr 2006 15:08:26 +0200 + +poppler (0.5.1-0ubuntu6) dapper; urgency=low + + * Install poppler-page-transition into libpoppler-qt-dev (not + libpoppler-dev), since it comes from the Qt bindings. Closes: LP#32179 + + -- Martin Pitt Mon, 10 Apr 2006 12:20:46 +0200 + +poppler (0.5.1-0ubuntu5) dapper; urgency=low + + * debian/patches/000_incorrect_define_fix.patch: + - patch from the CVS, fix an incorrect boxes rendering (Ubuntu: #33239) + + -- Sebastien Bacher Thu, 23 Mar 2006 12:33:17 +0100 + +poppler (0.5.1-0ubuntu4) dapper; urgency=low + + * debian/control.in: libpoppler-dev needs to depend on libfontconfig1-dev, + because we directly include in GlobalParams.h + + -- Adam Conrad Thu, 16 Mar 2006 11:23:00 +1100 + +poppler (0.5.1-0ubuntu3) dapper; urgency=low + + * debian/control.in: Have poppler-utils Replace: xpdf-reader, since both + contain pdftoppm.1.gz. + + -- Martin Pitt Mon, 13 Mar 2006 09:10:12 +0100 + +poppler (0.5.1-0ubuntu2) dapper; urgency=low + + * debian/control.in: + - fix the libpoppler1 package description + + -- Sebastien Bacher Thu, 9 Mar 2006 09:43:15 +0000 + +poppler (0.5.1-0ubuntu1) dapper; urgency=low + + * New upstream version: + - Support for embedded files. + - Handle 0-width lines correctly. + - Avoid external file use when opening fonts. + - Only use vector fonts returned from fontconfig (#5758). + - Fix scaled 1x1 pixmaps use for drawing lines (#3387). + - drawSoftMaskedImage support in cairo backend. + - Misc bug fixes: #5922, #5946, #5749, #5952, #4030, #5420. + * debian/control.in, debian/libpoppler0c2.dirs, + debian/libpoppler0c2-glib.dirs, debian/libpoppler0c2-glib.install, + debian/libpoppler0c2.install, debian/libpoppler0c2-qt.dirs, + debian/libpoppler0c2-qt.install, debian/rules: + - updated for the soname change + * debian/patches/000_splash_build_fix.patch: + - fix build when using splash + * debian/patches/001_fixes_for_fonts_selection.patch: + - fix with the new version + + -- Sebastien Bacher Mon, 6 Mar 2006 18:42:44 +0000 + +poppler (0.5.0-0ubuntu5) dapper; urgency=low + + * debian/control.in, debian/rules: + - build without libcairo + + -- Sebastien Bacher Sun, 26 Feb 2006 20:05:10 +0100 + +poppler (0.5.0-0ubuntu4) dapper; urgency=low + + * debian/patches/001_fixes_for_fonts_selection.patch: + - change from the CVS, fix some renderings issues and fonts selection + + -- Sebastien Bacher Tue, 7 Feb 2006 13:38:04 +0100 + +poppler (0.5.0-0ubuntu3) dapper; urgency=low + + * SECURITY UPDATE: Buffer overflow. + * Add debian/patches/002_CVE-2006-0301.patch: + - splash/Splash.cc, Splash::drawPixel(), Splash::drawSpan(), + Splash::xorSpan(): Check coordinates for integer overflow. + * CVE-2006-0301 + + -- Martin Pitt Fri, 3 Feb 2006 18:13:30 +0000 + +poppler (0.5.0-0ubuntu2) dapper; urgency=low + + * debian/rules: Bump shlibs version to 0.5.0. + + -- Martin Pitt Fri, 20 Jan 2006 16:56:40 +0100 + +poppler (0.5.0-0ubuntu1) dapper; urgency=low + + * New upstream release 0.5.0, required for new evince 0.5. + * Merge with Debian. + * Remove patches adopted upstream: + - debian/patches/000_add-poppler-utils.patch + - debian/patches/002-selection-crash-bug.patch + * debian/libpoppler-dev.install: + - Install poppler-page-transition.h. + - Do not install poppler-config.h, it doesn't exist any more. + - Upstream doesn't install legacy xpdf includes any more, fix path to + install them into libpoppler-dev. + * Add debian/patches/001_jpxstream_int_crash.patch: + - poppler/JPXStream.h: Fix declaration of cbW to be signed. + JPXStream.cc, readCodeBlockData() negates the value, which results in an + invalid value on 64 bit platforms if using unsigned types. + - Thanks to Vladimir Nadvornik for pointing at this. + + -- Martin Pitt Thu, 19 Jan 2006 23:49:52 +0100 + +poppler (0.4.4-1) unstable; urgency=high + + * New upstream security release + - fixes CVE-2005-3624, CVE-2005-3625, CVE-2005-3627 + * Remove debian/patches/003-CVE-2005-3624_5_7.patch: + - Merged upstream + * Remove debian/patches/004-fix-CVE-2005-3192.patch: + - Merged upstream + * Remove debian/patches/001-relibtoolize.patch + - Upstream uses recent libtool + + -- Ondřej Surý Thu, 12 Jan 2006 20:40:27 +0100 + +poppler (0.4.3-3) unstable; urgency=low + + * Fix missing libcairo2-dev dependency (Closes: #346277) + + -- Ondřej Surý Fri, 6 Jan 2006 21:37:10 +0100 + +poppler (0.4.3-2) unstable; urgency=high + + [ Martin Pitt ] + * SECURITY UPDATE: Multiple integer/buffer overflows. + * Add debian/patches/003-CVE-2005-3624_5_7.patch: + - poppler/Stream.cc, CCITTFaxStream::CCITTFaxStream(): + + Check columns for negative or large values. + + CVE-2005-3624 + - poppler/Stream.cc, numComps checks introduced in CVE-2005-3191 patch: + + Reset numComps to 0 since it's a global variable that is used later. + + CVE-2005-3627 + - poppler/Stream.cc, DCTStream::readHuffmanTables(): + + Fix out of bounds array access in Huffman tables. + + CVE-2005-3627 + - poppler/Stream.cc, DCTStream::readMarker(): + + Check for EOF in while loop to prevent endless loops. + + CVE-2005-3625 + - poppler/JBIG2Stream.cc, JBIG2Bitmap::JBIG2Bitmap(), + JBIG2Bitmap::expand(), JBIG2Stream::readHalftoneRegionSeg(): + + Check user supplied width and height against invalid values. + + Allocate one extra byte to prevent out of bounds access in combine(). + * Add debian/patches/004-fix-CVE-2005-3192.patch: + - Fix nVals int overflow check in StreamPredictor::StreamPredictor(). + - Forwarded upstream to https://bugs.freedesktop.org/show_bug.cgi?id=5514. + + [ Ondřej Surý ] + * Merge changes from Ubuntu (Closes: #346076). + * Enable Cairo output again. + + -- Ondřej Surý Thu, 5 Jan 2006 14:54:44 +0100 + +poppler (0.4.3-1) unstable; urgency=high + + * New upstream release. + * New maintainer (Closes: #344738) + * CVE-2005-3191 and CAN-2005-2097 fixes merged upstream. + * Fixed some rendering bugs and disabled Cairo output + (Closes: #314556, #322964, #328211) + * Acknowledge NMU (Closes: #342288) + * Add 001-selection-crash-bug.patch (Closes: #330544) + * Add poppler-utils (merge patch from Ubuntu) + + -- Ondřej Surý Fri, 30 Dec 2005 11:34:07 +0100 + +poppler (0.4.2-1.1) unstable; urgency=high + + * SECURITY UPDATE: Multiple integer/buffer overflows. + + * NMU to fix RC security bug (closes: #342288) + * Add debian/patches/04_CVE-2005-3191_2_3.patch taken from Ubuntu, + thanks to Martin Pitt: + * poppler/Stream.cc, DCTStream::readBaselineSOF(), + DCTStream::readProgressiveSOF(), DCTStream::readScanInfo(): + - Check numComps for invalid values. + - http://www.idefense.com/application/poi/display?id=342&type=vulnerabilities + - CVE-2005-3191 + * poppler/Stream.cc, StreamPredictor::StreamPredictor(): + - Check rowBytes for invalid values. + - http://www.idefense.com/application/poi/display?id=344&type=vulnerabilities + - CVE-2005-3192 + * poppler/JPXStream.cc, JPXStream::readCodestream(): + - Check img.nXTiles * img.nYTiles for integer overflow. + - http://www.idefense.com/application/poi/display?id=345&type=vulnerabilities + - CVE-2005-3193 + + -- Frank Küster Fri, 23 Dec 2005 16:36:30 +0100 + +poppler (0.4.2-1) unstable; urgency=low + + * GNOME Team upload. + * New upstream version. + * debian/control.in: + - updated the Build-Depends on libqt (Closes: #326130). + * debian/rules: + - updated the shlibs. + + -- Sebastien Bacher Wed, 7 Sep 2005 12:41:48 +0200 + +poppler (0.4.0-1) unstable; urgency=low + + * GNOME Team Upload. + * Rebuild for the CPP transition. + * New upstream version (Closes: #311133): + - fix some crashers (Closes: #315590, #312261, #309410). + - fix some rendering defaults (Closes: #314441, #315383, #309697, #308785). + * debian/control.in, debian/rules: + - build with the current cairo version (Closes: #321368, #318293). + - update for the renamed the packages. + * debian/patches/01_CAN-2005-2097.patch: + - Patch from Ubuntu, thanks Martin Pitt. + - Check sanity of the TrueType "loca" table. Specially crafted broken + tables caused disk space exhaustion due to very large generated glyph + descriptions when attempting to fix the table. + - Upstream patch scheduled for xpdf 3.01. + - CAN-2005-2097 + * debian/watch: + - fixed, patch by Jerome Warnier (Closes: #310996). + + -- Sebastien Bacher Wed, 17 Aug 2005 21:54:07 +0200 + +poppler (0.3.1-1) unstable; urgency=low + + * New upstream release + * Upstream fixed the Qt build bug, so now I can enable Qt + build. (Closes:#307340) It leads two new binary packages + libpoppler0-qt and libpoppler-qt-dev. + * Excluded DEB_CONFIGURE_SYSCONFDIR setting, which is obsolete by the + upstream removal of xpdfrc config. + + -- Changwoo Ryu Wed, 4 May 2005 00:19:35 +0900 + +poppler (0.3.0-2) unstable; urgency=high + + * Added shlib version info for libpoppler0-glib. + * Corrected dependencies of libpoppler0-glib and libpoppler-glib-dev. + (Closes: #306897) + * Build-Depends on libgtk2.0-dev for -glib packages. (Closes: #306885) + * Corrected descriptions of -glib packages. + + -- Changwoo Ryu Thu, 28 Apr 2005 02:41:25 +0900 + +poppler (0.3.0-1) unstable; urgency=low + + * New upstream release (Closes: #306573) + * Added new binary packages libpoppler0-glib and libpoppler-glib-dev, + which are GLib-based interfaces. Qt interface build is termporarily + disabled, because of an upstream FTBFS. + + -- Changwoo Ryu Thu, 28 Apr 2005 02:07:23 +0900 + +poppler (0.1.2-1) unstable; urgency=low + + * Initial Release (Closes: #299518) + + -- Changwoo Ryu Tue, 15 Mar 2005 02:08:00 +0900 --- poppler-0.12.4.orig/debian/docs +++ poppler-0.12.4/debian/docs @@ -0,0 +1,5 @@ +AUTHORS +NEWS +README +README-XPDF +TODO --- poppler-0.12.4.orig/debian/compat +++ poppler-0.12.4/debian/compat @@ -0,0 +1 @@ +5 --- poppler-0.12.4.orig/debian/libpoppler-glib-dev.install +++ poppler-0.12.4/debian/libpoppler-glib-dev.install @@ -0,0 +1,6 @@ +debian/tmp/usr/share/gtk-doc/html/poppler/ usr/share/doc/libpoppler-glib-dev/html/ +debian/tmp/usr/include/poppler/glib/ +debian/tmp/usr/lib/libpoppler-glib.a +debian/tmp/usr/lib/libpoppler-glib.so +debian/tmp/usr/lib/pkgconfig/poppler-glib.pc +glib/.libs/test-poppler-glib usr/lib/poppler --- poppler-0.12.4.orig/debian/libpoppler5.install +++ poppler-0.12.4/debian/libpoppler5.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/libpoppler.so.* --- poppler-0.12.4.orig/debian/libpoppler-glib-dev.links +++ poppler-0.12.4/debian/libpoppler-glib-dev.links @@ -0,0 +1 @@ +usr/share/doc/libpoppler-glib-dev/html/poppler usr/share/gtk-doc/html/poppler --- poppler-0.12.4.orig/debian/libpoppler-qt4-3.install +++ poppler-0.12.4/debian/libpoppler-qt4-3.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/libpoppler-qt4.so.* --- poppler-0.12.4.orig/debian/rules +++ poppler-0.12.4/debian/rules @@ -0,0 +1,31 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/rules/simple-patchsys.mk +include /usr/share/cdbs/1/class/autotools.mk + +# use qt4's moc as the default moc is qt3's when both are installed +PATH := /usr/share/qt4/bin:$(PATH) +export PATH + +# a trick to fix xpdfrc location without modifying autotools stuff +DEB_CONFIGURE_SYSCONFDIR := /etc/xpdf + +# disable gtk stuff to minimize Build-Depends +DEB_CONFIGURE_EXTRA_FLAGS += \ + --enable-libjpeg \ + --disable-openjpeg \ + --enable-splash-output \ + --enable-cairo-output \ + --enable-poppler-glib \ + --enable-poppler-qt \ + --enable-poppler-qt4 \ + --enable-a4-paper \ + --enable-gtk-doc \ + --disable-gtk-test + +DEB_DH_MAKESHLIBS_ARGS_libpoppler5 += -V"libpoppler5" +DEB_DH_MAKESHLIBS_ARGS_libpoppler-glib4 += -V"libpoppler-glib4 (>= 0.12)" +DEB_DH_MAKESHLIBS_ARGS_libpoppler-qt2 += -V"libpoppler-qt2 (>= 0.12)" +DEB_DH_MAKESHLIBS_ARGS_libpoppler-qt4-3 += -V"libpoppler-qt4-3 (>= 0.12)" + --- poppler-0.12.4.orig/debian/watch +++ poppler-0.12.4/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://poppler.freedesktop.org/ poppler-([0-9.]*)\.tar\.gz debian uupdate --- poppler-0.12.4.orig/debian/libpoppler-qt4-dev.install +++ poppler-0.12.4/debian/libpoppler-qt4-dev.install @@ -0,0 +1,4 @@ +debian/tmp/usr/include/poppler/qt4 +debian/tmp/usr/lib/libpoppler-qt4.a +debian/tmp/usr/lib/libpoppler-qt4.so +debian/tmp/usr/lib/pkgconfig/poppler-qt4.pc --- poppler-0.12.4.orig/debian/copyright +++ poppler-0.12.4/debian/copyright @@ -0,0 +1,121 @@ +This package was debianized by Changwoo Ryu . + +It was downloaded from http://poppler.freedesktop.org + +Upstream Authors: + Derek Noonburg + Kristian Høgsberg + Albert Astals Cid + +Copyright: + Copyright © Adam Batkin + Copyright © Adobe Systems Inc. + Copyright © Adrian Johnson + Copyright © Adrian Page + Copyright © Albert Astals Cid + Copyright © Alexander Neundorf + Copyright © Boris Toloknov + Copyright © Brad Hards + Copyright © Carlos Garcia Campos + Copyright © Christian Persch + Copyright © Chris Wilson + Copyright © Daniel Veillard + Copyright © Dan Sheridan + Copyright © Darren Kenny + Copyright © David Benjamin + Copyright © David Faure + Copyright © Derek B. Noonburg + Copyright © Dominic Lachowicz + Copyright © Ed Avis + Copyright © Ed Catmur + Copyright © Enrico Ros + Copyright © Eric Toombs + Copyright © Free Software Foundation, Inc. + Copyright © Glyph & Cog, LLC. + Copyright © Gueorgui Ovtcharov + Copyright © Haruyuki Kawabe + Copyright © Hib Eris + Copyright © Hugo Mercier + Copyright © Ilmari Heikkinen + Copyright © Ilya Gorenbein + Copyright © Iñigo Martínez + Copyright © Insight Consortium + Copyright © Jakub Wilk + Copyright © Jan Jockusch + Copyright © Jauco Noordzij + Copyright © Jeff Muizelaar + Copyright © Jerry Epplin + Copyright © Jonathan Blandford + Copyright © Jonathan Kew + Copyright © Julien Rebetez + Copyright © KDAB via Guillermo Amaral + Copyright © Kees Cook + Copyright © Kitware, Inc. + Copyright © Kjartan Maraas + Copyright © Koji Otani + Copyright © Kouhei Sutou + Copyright © Kristian Høgsberg + Copyright © Krzysztof Kowalczyk + Copyright © Marco Pesenti Gritti + Copyright © Mark Kaplan + Copyright © Martin Kretzschmar + Copyright © Matthias Drochner + Copyright © Matthias Franz + Copyright © Michael K. Johnson + Copyright © Michael Vrable + Copyright © M Joonas Pihlaja + Copyright © Net Integration Technologies, Inc. + Copyright © Nick Jones + Copyright © Nickolay V. Shmyrev + Copyright © Paul Walmsley + Copyright © Peter Kerzum + Copyright © Petr Gajdos + Copyright © Pino Toscano + Copyright © Rainer Dorsch + Copyright © Rainer Keller + Copyright © Raj Kumar + Copyright © Red Hat, Inc. + Copyright © Richard Airlie + Copyright © Ross Moore + Copyright © Ryszard Trojnacki + Copyright © Sanjoy Mahajan + Copyright © Scott James Remnant + Copyright © Scott Turner + Copyright © Shawn Rutledge + Copyright © Shen Liang + Copyright © Stefan Kebekus + Copyright © Stefan Schweizer + Copyright © Steven G. Johnson + Copyright © Takashi Iwai + Copyright © The GLib Team + Copyright © The Poppler Developers + Copyright © Thomas Freitag + Copyright © Thorkild Stray + Copyright © Till Kamppeter + Copyright © Timothy Lee + Copyright © Tobias Koening + Copyright © Tomas Are Haavet + Copyright © Vasile Gaburici + Copyright © Warren Toomey + Copyright © Wilfried Huss + Copyright © William Bader + Copyright © Will Stephenson + Copyright © X Consortium + +License: + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL-2'. --- poppler-0.12.4.orig/debian/poppler-utils.install +++ poppler-0.12.4/debian/poppler-utils.install @@ -0,0 +1,2 @@ +debian/tmp/usr/bin/ +debian/tmp/usr/share/man/man1/ --- poppler-0.12.4.orig/debian/libpoppler-qt2.install +++ poppler-0.12.4/debian/libpoppler-qt2.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/libpoppler-qt.so.* --- poppler-0.12.4.orig/debian/libpoppler-glib4.install +++ poppler-0.12.4/debian/libpoppler-glib4.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/libpoppler-glib.so.* --- poppler-0.12.4.orig/debian/libpoppler-dev.install +++ poppler-0.12.4/debian/libpoppler-dev.install @@ -0,0 +1,9 @@ +poppler/*.h usr/include/poppler/ +fofi/*.h usr/include/poppler/fofi/ +goo/*.h usr/include/poppler/goo/ +splash/*.h usr/include/poppler/splash/ +debian/tmp/usr/lib/libpoppler.a +debian/tmp/usr/lib/libpoppler.so +debian/tmp/usr/lib/pkgconfig/poppler.pc +debian/tmp/usr/lib/pkgconfig/poppler-splash.pc +debian/tmp/usr/lib/pkgconfig/poppler-cairo.pc --- poppler-0.12.4.orig/debian/control +++ poppler-0.12.4/debian/control @@ -0,0 +1,156 @@ +Source: poppler +Section: devel +Priority: optional +Maintainer: Ubuntu Desktop Team +XSBC-Original-Maintainer: Loic Minier +Uploaders: Josselin Mouette , + Dave Beckett , + Ross Burton +Build-Depends: cdbs (>= 0.4.52), + debhelper (>= 5), + autotools-dev, + gnome-pkg-tools, + libglib2.0-dev (>= 2.6), + libgtk2.0-dev (>= 2.12), + libfontconfig1-dev, + libqt3-mt-dev (>= 3:3.3.4-4), + libqt4-dev (>= 4.6.0), + libcairo2-dev (>= 1.8.4), + libjpeg-dev, + libpng-dev, + liblcms-dev, + libfreetype6-dev, + libxml2-dev, + gtk-doc-tools (>= 1.0), + pkg-config (>= 0.18), + libglib2.0-doc +Standards-Version: 3.8.1 + +Package: libpoppler5 +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, + ${misc:Depends} +Description: PDF rendering library + Poppler is a PDF rendering library based on xpdf PDF viewer. + . + This package contains the shared library. + +Package: libpoppler-dev +Architecture: any +Section: libdevel +Depends: libpoppler5 (= ${binary:Version}), + libfontconfig1-dev, + ${shlibs:Depends}, + ${misc:Depends} +Description: PDF rendering library -- development files + Poppler is a PDF rendering library based on xpdf PDF viewer. + . + This package contains the headers and development libraries needed to + build applications using Poppler. + +Package: libpoppler-glib4 +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, + ${misc:Depends} +Description: PDF rendering library (GLib-based shared library) + Poppler is a PDF rendering library based on xpdf PDF viewer. + . + This package provides the GLib-based shared library for applications + using the GLib interface to Poppler. + +Package: libpoppler-glib-dev +Architecture: any +Section: libdevel +Depends: libpoppler-glib4 (= ${binary:Version}), + libpoppler-dev (= ${binary:Version}), + libglib2.0-dev (>= 2.12), + libpango1.0-dev, + libcairo2-dev (>= 1.8.4), + ${shlibs:Depends}, + ${misc:Depends} +Description: PDF rendering library -- development files (GLib interface) + Poppler is a PDF rendering library based on xpdf PDF viewer. + . + This package provides a GLib-style interface to Poppler. + +Package: libpoppler-qt2 +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, + ${misc:Depends} +Description: PDF rendering library (Qt 3 based shared library) + Poppler is a PDF rendering library based on xpdf PDF viewer. + . + This package provides the Qt 3 based shared library for applications + using the Qt 3 interface to Poppler. + +Package: libpoppler-qt-dev +Architecture: any +Section: libdevel +Depends: libpoppler-qt2 (= ${binary:Version}), + libpoppler-dev (= ${binary:Version}), + libqt3-mt-dev, + ${shlibs:Depends}, + ${misc:Depends} +Description: PDF rendering library -- development files (Qt 3 interface) + Poppler is a PDF rendering library based on xpdf PDF viewer. + . + This package provides a Qt 3 style interface to Poppler. + +Package: libpoppler-qt4-3 +Architecture: any +Section: libs +Depends: ${shlibs:Depends}, + ${misc:Depends} +Description: PDF rendering library (Qt 4 based shared library) + Poppler is a PDF rendering library based on xpdf PDF viewer. + . + This package provides the Qt 4 based shared library for applications + using the Qt 4 interface to Poppler. + +Package: libpoppler-qt4-dev +Architecture: any +Section: libdevel +Depends: libpoppler-qt4-3 (= ${binary:Version}), + libpoppler-dev (= ${binary:Version}), + libqt4-dev, + ${shlibs:Depends}, + ${misc:Depends} +Description: PDF rendering library -- development files (Qt 4 interface) + Poppler is a PDF rendering library based on xpdf PDF viewer. + . + This package provides a Qt 4 style interface to Poppler. + +Package: poppler-utils +Architecture: any +Section: utils +Depends: ${shlibs:Depends}, + ${misc:Depends} +Recommends: ghostscript +Conflicts: xpdf-utils, + pdftohtml (<< 0.36-14) +Replaces: xpdf-utils, + pdftohtml, + xpdf-reader +Provides: xpdf-utils, + pdftohtml +Description: PDF utilitites (based on libpoppler) + This package contains pdftops (PDF to PostScript converter), pdfinfo + (PDF document information extractor), pdfimages (PDF image extractor), + pdftohtml (PDF to HTML converter), pdftotext (PDF to text converter), + and pdffonts (PDF font analyzer). + +Package: poppler-dbg +Architecture: any +Section: debug +Priority: extra +Depends: ${misc:Depends}, + libpoppler5 (= ${binary:Version}), + ${shlibs:Depends} +Description: PDF rendering library - detached debugging symbols + Poppler is a PDF rendering library based on xpdf PDF viewer. + . + This package contains the detached debugging symbols. + --- poppler-0.12.4.orig/debian/patches/CVE-2013-1790.patch +++ poppler-0.12.4/debian/patches/CVE-2013-1790.patch @@ -0,0 +1,249 @@ +Description: fix uninitialized memory read +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=931051fe0bb445545355027d999515bc3d4b32ef +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=50c0b294d08114920a5db711876e20d991f474a6 +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=31874f2e065b0d68f726ef404de98f42489c80c7 +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=e8822c0f3a46195ec7c6e55c556dd0c5716be742 +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=2017dbebd9afd4f172242ff8462fce739d911e64 +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=b1026b5978c385328f2a15a2185c599a563edf91 +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702071 + +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4/poppler/Stream.cc poppler-0.12.4.new/poppler/Stream.cc +--- poppler-0.12.4/poppler/Stream.cc 2013-03-27 14:05:34.576130485 -0400 ++++ poppler-0.12.4.new/poppler/Stream.cc 2013-03-27 14:05:39.404130439 -0400 +@@ -409,7 +409,7 @@ + // force a call to gmallocn(-1,...), which will throw an exception + imgLineSize = -1; + } +- imgLine = (Guchar *)gmallocn(imgLineSize, sizeof(Guchar)); ++ imgLine = (Guchar *)gmallocn_checkoverflow(imgLineSize, sizeof(Guchar)); + imgIdx = nVals; + } + +@@ -1473,11 +1473,12 @@ + + // 2-D encoding + if (nextLine2D) { +- for (i = 0; codingLine[i] < columns; ++i) { ++ for (i = 0; i < columns && codingLine[i] < columns; ++i) { + refLine[i] = codingLine[i]; + } +- refLine[i++] = columns; +- refLine[i] = columns; ++ for (; i < columns + 2; ++i) { ++ refLine[i] = columns; ++ } + codingLine[0] = 0; + a0i = 0; + b1i = 0; +@@ -1489,13 +1490,15 @@ + // codingLine[a0i = 0] = refLine[b1i = 0] = 0 is possible + // exception at right edge: + // refLine[b1i] = refLine[b1i+1] = columns is possible +- while (codingLine[a0i] < columns) { ++ while (codingLine[a0i] < columns && !err) { + code1 = getTwoDimCode(); + switch (code1) { + case twoDimPass: +- addPixels(refLine[b1i + 1], blackPixels); +- if (refLine[b1i + 1] < columns) { +- b1i += 2; ++ if (likely(b1i + 1 < columns + 2)) { ++ addPixels(refLine[b1i + 1], blackPixels); ++ if (refLine[b1i + 1] < columns) { ++ b1i += 2; ++ } + } + break; + case twoDimHoriz: +@@ -1521,49 +1524,109 @@ + } + while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { + b1i += 2; ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + } + break; + case twoDimVertR3: ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + addPixels(refLine[b1i] + 3, blackPixels); + blackPixels ^= 1; + if (codingLine[a0i] < columns) { + ++b1i; + while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { + b1i += 2; ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + } + } + break; + case twoDimVertR2: ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + addPixels(refLine[b1i] + 2, blackPixels); + blackPixels ^= 1; + if (codingLine[a0i] < columns) { + ++b1i; + while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { + b1i += 2; ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + } + } + break; + case twoDimVertR1: ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + addPixels(refLine[b1i] + 1, blackPixels); + blackPixels ^= 1; + if (codingLine[a0i] < columns) { + ++b1i; + while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { + b1i += 2; ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + } + } + break; + case twoDimVert0: ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + addPixels(refLine[b1i], blackPixels); + blackPixels ^= 1; + if (codingLine[a0i] < columns) { + ++b1i; + while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { + b1i += 2; ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + } + } + break; + case twoDimVertL3: ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + addPixelsNeg(refLine[b1i] - 3, blackPixels); + blackPixels ^= 1; + if (codingLine[a0i] < columns) { +@@ -1574,10 +1637,22 @@ + } + while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { + b1i += 2; ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + } + } + break; + case twoDimVertL2: ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + addPixelsNeg(refLine[b1i] - 2, blackPixels); + blackPixels ^= 1; + if (codingLine[a0i] < columns) { +@@ -1588,10 +1663,22 @@ + } + while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { + b1i += 2; ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + } + } + break; + case twoDimVertL1: ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + addPixelsNeg(refLine[b1i] - 1, blackPixels); + blackPixels ^= 1; + if (codingLine[a0i] < columns) { +@@ -1602,6 +1689,12 @@ + } + while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < columns) { + b1i += 2; ++ if (unlikely(b1i > columns + 1)) { ++ error(getPos(), ++ "Bad 2D code %04x in CCITTFax stream", code1); ++ err = gTrue; ++ break; ++ } + } + } + break; +@@ -1752,6 +1845,12 @@ + outputBits = 0; + if (codingLine[a0i] < columns) { + ++a0i; ++ if (unlikely(a0i > columns)) { ++ error(getPos(), ++ "Bad bits %04x in CCITTFax stream", bits); ++ err = gTrue; ++ break; ++ } + outputBits = codingLine[a0i] - codingLine[a0i - 1]; + } else if (bits > 0) { + buf <<= bits; +@@ -2300,6 +2399,9 @@ + vSub = vert / 8; + for (y2 = 0; y2 < mcuHeight; y2 += vert) { + for (x2 = 0; x2 < mcuWidth; x2 += horiz) { ++ if (unlikely(scanInfo.dcHuffTable[cc] >= 4) || unlikely(scanInfo.acHuffTable[cc] >= 4)) { ++ return gFalse; ++ } + if (!readDataUnit(&dcHuffTables[scanInfo.dcHuffTable[cc]], + &acHuffTables[scanInfo.acHuffTable[cc]], + &compInfo[cc].prevDC, --- poppler-0.12.4.orig/debian/patches/10_fix-a4-page-shift-on-brother-ps-printers.patch +++ poppler-0.12.4/debian/patches/10_fix-a4-page-shift-on-brother-ps-printers.patch @@ -0,0 +1,11 @@ +diff -Nur -x '*.orig' -x '*~' poppler-0.12.2/poppler/PSOutputDev.cc poppler-0.12.2.new/poppler/PSOutputDev.cc +--- poppler-0.12.2/poppler/PSOutputDev.cc 2009-11-13 00:52:35.000000000 +0100 ++++ poppler-0.12.2.new/poppler/PSOutputDev.cc 2009-12-17 23:36:22.297158221 +0100 +@@ -114,7 +114,6 @@ + " pop 3 dict begin", + " /PageSize exch def", + " /ImagingBBox null def", +- " /Policies 1 dict dup begin /PageSize 3 def end def", + " { /Duplex true def } if", + " currentdict end setpagedevice", + " } {", --- poppler-0.12.4.orig/debian/patches/CVE-2010-3702.patch +++ poppler-0.12.4/debian/patches/CVE-2010-3702.patch @@ -0,0 +1,23 @@ +Description: fix possible arbitrary code execution via malformed PDF +Origin: upstream, http://cgit.freedesktop.org/poppler/poppler/commit/?id=e853106b58d6b4b0467dbd6436c9bb1cfbd372cf +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=599165 + +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4//poppler/Gfx.cc poppler-0.12.4.new//poppler/Gfx.cc +--- poppler-0.12.4//poppler/Gfx.cc 2010-01-22 18:54:42.000000000 -0500 ++++ poppler-0.12.4.new//poppler/Gfx.cc 2010-10-13 15:49:59.000000000 -0400 +@@ -518,6 +518,7 @@ + drawText = gFalse; + maskHaveCSPattern = gFalse; + mcStack = NULL; ++ parser = NULL; + + // start the resource stack + res = new GfxResources(xref, resDict, NULL); +@@ -570,6 +571,7 @@ + drawText = gFalse; + maskHaveCSPattern = gFalse; + mcStack = NULL; ++ parser = NULL; + + // start the resource stack + res = new GfxResources(xref, resDict, NULL); --- poppler-0.12.4.orig/debian/patches/12_set-font-weight-medium.patch +++ poppler-0.12.4/debian/patches/12_set-font-weight-medium.patch @@ -0,0 +1,16 @@ +## Description: set FC_WEIGHT_MEDIUM when the font name contains "Medium" +## Author: Nobuto MURATA +## Bug-Ubuntu: https://launchpad.net/bugs/769827 +## Forwarded: no +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4//poppler/GlobalParams.cc poppler-0.12.4.new//poppler/GlobalParams.cc +--- poppler-0.12.4//poppler/GlobalParams.cc 2010-01-17 09:06:58.000000000 +0900 ++++ poppler-0.12.4.new//poppler/GlobalParams.cc 2011-04-26 09:55:02.054201079 +0900 +@@ -997,6 +997,8 @@ + slant = FC_SLANT_ITALIC; + if (findModifier(modifiers, "Bold", &start)) + weight = FC_WEIGHT_BOLD; ++ if (findModifier(modifiers, "Medium", &start)) ++ weight = FC_WEIGHT_MEDIUM; + if (findModifier(modifiers, "Light", &start)) + weight = FC_WEIGHT_LIGHT; + if (findModifier(modifiers, "Condensed", &start)) --- poppler-0.12.4.orig/debian/patches/CVE-2013-1788.patch +++ poppler-0.12.4/debian/patches/CVE-2013-1788.patch @@ -0,0 +1,100 @@ +Description: fix invalid memory access issues +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=9529e776e53e71069ba4215cdb8b84592d37b555 +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=e5661e1a08c38d4c8d69976a8c1c02c1102bc88c +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=d0df8e54512f584ca2b3edbae1c19e167948e5c3 +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=8b6dc55e530b2f5ede6b9dfb64aafdd1d5836492 +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=e14b6e9c13d35c9bd1e0c50906ace8e707816888 +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=0388837f01bc467045164f9ddaff787000a8caaa +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702071 + +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4/poppler/Function.cc poppler-0.12.4.new/poppler/Function.cc +--- poppler-0.12.4/poppler/Function.cc 2013-03-27 14:05:21.192130613 -0400 ++++ poppler-0.12.4.new/poppler/Function.cc 2013-03-27 14:05:25.032130576 -0400 +@@ -255,6 +255,10 @@ + goto err3; + } + sampleSize[i] = obj2.getInt(); ++ if (sampleSize[i] <= 0) { ++ error(-1, "Illegal non-positive value in function size array"); ++ goto err3; ++ } + obj2.free(); + } + obj1.free(); +@@ -930,6 +934,10 @@ + return; + } + --sp; ++ if (sp + i + 1 >= psStackSize) { ++ error(-1, "Stack underflow in PostScript function"); ++ return; ++ } + stack[sp] = stack[sp + 1 + i]; + } + void pop() +@@ -978,6 +986,10 @@ + error(-1, "Stack underflow in PostScript function"); + return; + } ++ if (unlikely(sp - n > psStackSize)) { ++ error(-1, "Stack underflow in PostScript function"); ++ return; ++ } + if (!checkOverflow(n)) { + return; + } +@@ -999,7 +1011,7 @@ + j = n - j; + } + } +- if (n <= 0 || j == 0) { ++ if (n <= 0 || j == 0 || n > psStackSize || sp + n > psStackSize) { + return; + } + if (j <= n / 2) { +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4/poppler/Stream.cc poppler-0.12.4.new/poppler/Stream.cc +--- poppler-0.12.4/poppler/Stream.cc 2010-01-16 19:06:57.000000000 -0500 ++++ poppler-0.12.4.new/poppler/Stream.cc 2013-03-27 14:05:25.036130576 -0400 +@@ -2013,7 +2013,8 @@ + + // clip [-256,511] --> [0,255] + #define dctClipOffset 256 +-static Guchar dctClip[768]; ++#define dctClipLength 768 ++static Guchar dctClip[dctClipLength]; + static int dctClipInit = 0; + + // zig zag decode map +@@ -2959,7 +2960,12 @@ + + // convert to 8-bit integers + for (i = 0; i < 64; ++i) { +- dataOut[i] = dctClip[dctClipOffset + 128 + ((dataIn[i] + 8) >> 4)]; ++ const int ix = dctClipOffset + 128 + ((dataIn[i] + 8) >> 4); ++ if (unlikely(ix < 0 || ix >= dctClipLength)) { ++ dataOut[i] = 0; ++ } else { ++ dataOut[i] = dctClip[ix]; ++ } + } + } + +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4/splash/Splash.cc poppler-0.12.4.new/splash/Splash.cc +--- poppler-0.12.4/splash/Splash.cc 2010-01-16 19:06:57.000000000 -0500 ++++ poppler-0.12.4.new/splash/Splash.cc 2013-03-27 14:05:25.036130576 -0400 +@@ -1461,11 +1461,14 @@ + lineDashStartPhase -= (SplashCoord)i * lineDashTotal; + lineDashStartOn = gTrue; + lineDashStartIdx = 0; +- while (lineDashStartPhase >= state->lineDash[lineDashStartIdx]) { ++ while (lineDashStartIdx < state->lineDashLength && lineDashStartPhase >= state->lineDash[lineDashStartIdx]) { + lineDashStartOn = !lineDashStartOn; + lineDashStartPhase -= state->lineDash[lineDashStartIdx]; + ++lineDashStartIdx; + } ++ if (lineDashStartIdx == state->lineDashLength) { ++ return new SplashPath(); ++ } + + dPath = new SplashPath(); + --- poppler-0.12.4.orig/debian/patches/backport-anti-alias.patch +++ poppler-0.12.4/debian/patches/backport-anti-alias.patch @@ -0,0 +1,558 @@ +From: Carlos Garcia Campos +Subject: Anti-alias graphics in PDF documents +Origin: upstream, http://bugs.freedesktop.org/attachment.cgi?id=32750 +Bug: http://bugs.freedesktop.org/show_bug.cgi?id=5589 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/poppler/+bug/248355 +diff -Nur -x '*.orig' -x '*~' poppler/poppler/CairoOutputDev.cc poppler.new/poppler/CairoOutputDev.cc +--- poppler/poppler/CairoOutputDev.cc 2010-03-30 23:08:49.306054000 +0100 ++++ poppler.new/poppler/CairoOutputDev.cc 2010-03-30 23:22:56.511527017 +0100 +@@ -58,6 +58,7 @@ + #include + #include "CairoOutputDev.h" + #include "CairoFontEngine.h" ++#include "CairoRescaleBox.h" + //------------------------------------------------------------------------ + + // #define LOG_CAIRO +@@ -1291,6 +1292,82 @@ + clearSoftMask(state); + } + ++cairo_surface_t *CairoOutputDev::downscaleSurface(cairo_surface_t *orig_surface) { ++ cairo_surface_t *dest_surface; ++ unsigned char *dest_buffer; ++ int dest_stride; ++ unsigned char *orig_buffer; ++ int orig_width, orig_height; ++ int orig_stride; ++ GBool res; ++ ++ if (printing) ++ return NULL; ++ ++ cairo_matrix_t matrix; ++ cairo_get_matrix(cairo, &matrix); ++ ++ /* this whole computation should be factored out */ ++ double xScale = matrix.xx; ++ double yScale = matrix.yy; ++ int tx, tx2, ty, ty2; /* the integer co-oridinates of the resulting image */ ++ int scaledHeight; ++ int scaledWidth; ++ if (xScale >= 0) { ++ tx = splashRound(matrix.x0 - 0.01); ++ tx2 = splashRound(matrix.x0 + xScale + 0.01) - 1; ++ } else { ++ tx = splashRound(matrix.x0 + 0.01) - 1; ++ tx2 = splashRound(matrix.x0 + xScale - 0.01); ++ } ++ scaledWidth = abs(tx2 - tx) + 1; ++ //scaledWidth = splashRound(fabs(xScale)); ++ if (scaledWidth == 0) { ++ // technically, this should draw nothing, but it generally seems ++ // better to draw a one-pixel-wide stripe rather than throwing it ++ // away ++ scaledWidth = 1; ++ } ++ if (yScale >= 0) { ++ ty = splashFloor(matrix.y0 + 0.01); ++ ty2 = splashCeil(matrix.y0 + yScale - 0.01); ++ } else { ++ ty = splashCeil(matrix.y0 - 0.01); ++ ty2 = splashFloor(matrix.y0 + yScale + 0.01); ++ } ++ scaledHeight = abs(ty2 - ty); ++ if (scaledHeight == 0) { ++ scaledHeight = 1; ++ } ++ ++ orig_width = cairo_image_surface_get_width (orig_surface); ++ orig_height = cairo_image_surface_get_height (orig_surface); ++ if (scaledWidth >= orig_width || scaledHeight >= orig_height) ++ return NULL; ++ ++ dest_surface = cairo_surface_create_similar (orig_surface, ++ cairo_surface_get_content (orig_surface), ++ scaledWidth, scaledHeight); ++ dest_buffer = cairo_image_surface_get_data (dest_surface); ++ dest_stride = cairo_image_surface_get_stride (dest_surface); ++ ++ orig_buffer = cairo_image_surface_get_data (orig_surface); ++ orig_stride = cairo_image_surface_get_stride (orig_surface); ++ ++ res = downscale_box_filter((uint32_t *)orig_buffer, ++ orig_stride, orig_width, orig_height, ++ scaledWidth, scaledHeight, 0, 0, ++ scaledWidth, scaledHeight, ++ (uint32_t *)dest_buffer, dest_stride); ++ if (!res) { ++ cairo_surface_destroy (dest_surface); ++ return NULL; ++ } ++ ++ return dest_surface; ++ ++} ++ + void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, + int width, int height, GBool invert, + GBool interpolate, GBool inlineImg) { +@@ -2043,6 +2120,18 @@ + } + gfree(lookup); + ++ cairo_surface_t *scaled_surface; ++ ++ scaled_surface = downscaleSurface (image); ++ if (scaled_surface) { ++ if (cairo_surface_status (scaled_surface)) ++ goto cleanup; ++ cairo_surface_destroy (image); ++ image = scaled_surface; ++ width = cairo_image_surface_get_width (image); ++ height = cairo_image_surface_get_height (image); ++ } ++ + cairo_surface_mark_dirty (image); + pattern = cairo_pattern_create_for_surface (image); + cairo_surface_destroy (image); +diff -Nur -x '*.orig' -x '*~' poppler/poppler/CairoOutputDev.h poppler.new/poppler/CairoOutputDev.h +--- poppler/poppler/CairoOutputDev.h 2010-03-30 23:08:49.306054000 +0100 ++++ poppler.new/poppler/CairoOutputDev.h 2010-03-30 23:22:56.531526906 +0100 +@@ -268,6 +268,7 @@ + + protected: + void doPath(cairo_t *cairo, GfxState *state, GfxPath *path); ++ cairo_surface_t *downscaleSurface(cairo_surface_t *orig_surface); + + GfxRGB fill_color, stroke_color; + cairo_pattern_t *fill_pattern, *stroke_pattern; +diff -Nur -x '*.orig' -x '*~' poppler/poppler/CairoRescaleBox.cc poppler.new/poppler/CairoRescaleBox.cc +--- poppler/poppler/CairoRescaleBox.cc 1970-01-01 01:00:00.000000000 +0100 ++++ poppler.new/poppler/CairoRescaleBox.cc 2010-03-30 23:22:56.559527323 +0100 +@@ -0,0 +1,352 @@ ++/* -*- Mode: c; c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t; -*- */ ++/* ++ * Copyright © 2009 Mozilla Corporation ++ * ++ * Permission to use, copy, modify, distribute, and sell this software and its ++ * documentation for any purpose is hereby granted without fee, provided that ++ * the above copyright notice appear in all copies and that both that ++ * copyright notice and this permission notice appear in supporting ++ * documentation, and that the name of Mozilla Corporation not be used in ++ * advertising or publicity pertaining to distribution of the software without ++ * specific, written prior permission. Mozilla Corporation makes no ++ * representations about the suitability of this software for any purpose. It ++ * is provided "as is" without express or implied warranty. ++ * ++ * MOZILLA CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, ++ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ++ * SHALL MOZILLA CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR ++ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, ++ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER ++ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE ++ * OF THIS SOFTWARE. ++ * ++ * Author: Jeff Muizelaar, Mozilla Corp. ++ */ ++ ++/* This implements a box filter that supports non-integer box sizes */ ++ ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ ++#include ++#include ++#include ++#include ++#include ++#include "goo/gmem.h" ++#include "CairoRescaleBox.h" ++ ++typedef unsigned short int uint16_t; ++typedef unsigned int uint32_t; ++ ++/* we work in fixed point where 1. == 1 << 24 */ ++#define FIXED_SHIFT 24 ++ ++static void downsample_row_box_filter ( ++ int start, int width, ++ uint32_t *src, uint32_t *dest, ++ int coverage[], int pixel_coverage) ++{ ++ /* we need an array of the pixel contribution of each destination pixel on the boundaries. ++ * we invert the value to get the value on the other size of the box */ ++ /* ++ ++ value = a * contribution * 1/box_size ++ value += a * 1/box_size ++ value += a * 1/box_size ++ value += a * 1/box_size ++ value += a * (1 - contribution) * 1/box_size ++ a * (1/box_size - contribution * 1/box_size) ++ ++ box size is constant ++ ++ ++ value = a * contribtion_a * 1/box_size + b * contribution_b * 1/box_size ++ contribution_b = (1 - contribution_a) ++ = (1 - contribution_a_next) ++ */ ++ ++ /* box size = ceil(src_width/dest_width) */ ++ int x = 0; ++ ++ /* skip to start */ ++ /* XXX: it might be possible to do this directly instead of iteratively, however ++ * the iterative solution is simple */ ++ while (x < start) ++ { ++ int box = 1 << FIXED_SHIFT; ++ int start_coverage = coverage[x]; ++ box -= start_coverage; ++ src++; ++ while (box >= pixel_coverage) ++ { ++ src++; ++ box -= pixel_coverage; ++ } ++ x++; ++ } ++ ++ while (x < start + width) ++ { ++ uint32_t a = 0; ++ uint32_t r = 0; ++ uint32_t g = 0; ++ uint32_t b = 0; ++ int box = 1 << FIXED_SHIFT; ++ int start_coverage = coverage[x]; ++ ++ a = ((*src >> 24) & 0xff) * start_coverage; ++ r = ((*src >> 16) & 0xff) * start_coverage; ++ g = ((*src >> 8) & 0xff) * start_coverage; ++ b = ((*src >> 0) & 0xff) * start_coverage; ++ src++; ++ x++; ++ box -= start_coverage; ++ ++ while (box >= pixel_coverage) ++ { ++ a += ((*src >> 24) & 0xff) * pixel_coverage; ++ r += ((*src >> 16) & 0xff) * pixel_coverage; ++ g += ((*src >> 8) & 0xff) * pixel_coverage; ++ b += ((*src >> 0) & 0xff) * pixel_coverage; ++ src++; ++ ++ box -= pixel_coverage; ++ } ++ ++ /* multiply by whatever is leftover ++ * this ensures that we don't bias down. ++ * i.e. start_coverage + n*pixel_coverage + box == 1 << 24 */ ++ if (box > 0) ++ { ++ a += ((*src >> 24) & 0xff) * box; ++ r += ((*src >> 16) & 0xff) * box; ++ g += ((*src >> 8) & 0xff) * box; ++ b += ((*src >> 0) & 0xff) * box; ++ } ++ ++ a >>= FIXED_SHIFT; ++ r >>= FIXED_SHIFT; ++ g >>= FIXED_SHIFT; ++ b >>= FIXED_SHIFT; ++ ++ *dest = (a << 24) | (r << 16) | (g << 8) | b; ++ dest++; ++ } ++} ++ ++static void downsample_columns_box_filter ( ++ int n, ++ int start_coverage, ++ int pixel_coverage, ++ uint32_t *src, uint32_t *dest) ++{ ++ int stride = n; ++ while (n--) { ++ uint32_t a = 0; ++ uint32_t r = 0; ++ uint32_t g = 0; ++ uint32_t b = 0; ++ uint32_t *column_src = src; ++ int box = 1 << FIXED_SHIFT; ++ ++ a = ((*column_src >> 24) & 0xff) * start_coverage; ++ r = ((*column_src >> 16) & 0xff) * start_coverage; ++ g = ((*column_src >> 8) & 0xff) * start_coverage; ++ b = ((*column_src >> 0) & 0xff) * start_coverage; ++ column_src += stride; ++ box -= start_coverage; ++ ++ while (box >= pixel_coverage) ++ { ++ a += ((*column_src >> 24) & 0xff) * pixel_coverage; ++ r += ((*column_src >> 16) & 0xff) * pixel_coverage; ++ g += ((*column_src >> 8) & 0xff) * pixel_coverage; ++ b += ((*column_src >> 0) & 0xff) * pixel_coverage; ++ column_src += stride; ++ box -= pixel_coverage; ++ } ++ ++ if (box > 0) { ++ a += ((*column_src >> 24) & 0xff) * box; ++ r += ((*column_src >> 16) & 0xff) * box; ++ g += ((*column_src >> 8) & 0xff) * box; ++ b += ((*column_src >> 0) & 0xff) * box; ++ } ++ ++ a >>= FIXED_SHIFT; ++ r >>= FIXED_SHIFT; ++ g >>= FIXED_SHIFT; ++ b >>= FIXED_SHIFT; ++ ++ *dest = (a << 24) | (r << 16) | (g << 8) | b; ++ dest++; ++ src++; ++ } ++} ++ ++static int compute_coverage (int coverage[], int src_length, int dest_length) ++{ ++ int i; ++ /* num = src_length/dest_length ++ total = sum(pixel) / num ++ ++ pixel * 1/num == pixel * dest_length / src_length ++ */ ++ /* the average contribution of each source pixel */ ++ int ratio = ((1 << 24)*(long long int)dest_length)/src_length; ++ /* because ((1 << 24)*(long long int)dest_length) won't always be divisible by src_length ++ * we'll need someplace to put the other bits. ++ * ++ * We want to ensure a + n*ratio < 1<<24 ++ * ++ * 1<<24 ++ * */ ++ ++ double scale = (double)src_length/dest_length; ++ ++ /* for each destination pixel compute the coverage of the left most pixel included in the box */ ++ /* I have a proof of this, which this margin is too narrow to contain */ ++ for (i=0; i= i*scale ++ ++ floor((i+1)*scale) - ceil(i*scale) <= scale ++ ++ further since: floor((i+1)*scale) - ceil(i*scale) is an integer ++ ++ therefore: ++ floor((i+1)*scale) - ceil(i*scale) <= floor(scale) ++ */ ++ ++ if (left_fract == 0.) ++ count--; ++ ++ /* compute how much the right-most pixel contributes */ ++ overage = ratio*(right_fract); ++ ++ /* the remainder is the the amount that the left-most pixel ++ * contributes */ ++ coverage[i] = (1<<24) - (count * ratio + overage); ++ } ++ ++ return ratio; ++} ++ ++GBool downscale_box_filter(uint32_t *orig, int orig_stride, unsigned orig_width, unsigned orig_height, ++ signed scaled_width, signed scaled_height, ++ uint16_t start_column, uint16_t start_row, ++ uint16_t width, uint16_t height, ++ uint32_t *dest, int dst_stride) ++{ ++ int pixel_coverage_x, pixel_coverage_y; ++ int dest_y; ++ int src_y = 0; ++ uint32_t *scanline = orig; ++ int *x_coverage = NULL; ++ int *y_coverage = NULL; ++ uint32_t *temp_buf = NULL; ++ GBool retval = gFalse; ++ ++ x_coverage = (int *)gmallocn3 (orig_width, 1, sizeof(int)); ++ y_coverage = (int *)gmallocn3 (orig_height, 1, sizeof(int)); ++ ++ /* we need to allocate enough room for ceil(src_height/dest_height)+1 ++ Example: ++ src_height = 140 ++ dest_height = 50 ++ src_height/dest_height = 2.8 ++ ++ |-------------| 2.8 pixels ++ |----|----|----|----| 4 pixels ++ need to sample 3 pixels ++ ++ |-------------| 2.8 pixels ++ |----|----|----|----| 4 pixels ++ need to sample 4 pixels ++ */ ++ ++ temp_buf = (uint32_t *)gmallocn3 ((orig_height + scaled_height-1)/scaled_height+1, scaled_width, sizeof(uint32_t)); ++ ++ if (!x_coverage || !y_coverage || !scanline || !temp_buf) ++ goto cleanup; ++ ++ pixel_coverage_x = compute_coverage (x_coverage, orig_width, scaled_width); ++ pixel_coverage_y = compute_coverage (y_coverage, orig_height, scaled_height); ++ ++ assert (width + start_column <= scaled_width); ++ ++ /* skip the rows at the beginning */ ++ for (dest_y = 0; dest_y < start_row; dest_y++) ++ { ++ int box = 1 << FIXED_SHIFT; ++ int start_coverage_y = y_coverage[dest_y]; ++ box -= start_coverage_y; ++ src_y++; ++ while (box >= pixel_coverage_y) ++ { ++ box -= pixel_coverage_y; ++ src_y++; ++ } ++ } ++ ++ for (; dest_y < start_row + height; dest_y++) ++ { ++ int columns = 0; ++ int box = 1 << FIXED_SHIFT; ++ int start_coverage_y = y_coverage[dest_y]; ++ ++ scanline = orig + src_y * orig_stride / 4; ++ downsample_row_box_filter (start_column, width, scanline, temp_buf + width * columns, x_coverage, pixel_coverage_x); ++ columns++; ++ src_y++; ++ box -= start_coverage_y; ++ ++ while (box >= pixel_coverage_y) ++ { ++ scanline = orig + src_y * orig_stride / 4; ++ downsample_row_box_filter (start_column, width, scanline, temp_buf + width * columns, x_coverage, pixel_coverage_x); ++ columns++; ++ src_y++; ++ box -= pixel_coverage_y; ++ } ++ ++ /* downsample any leftovers */ ++ if (box > 0) ++ { ++ scanline = orig + src_y * orig_stride / 4; ++ downsample_row_box_filter (start_column, width, scanline, temp_buf + width * columns, x_coverage, pixel_coverage_x); ++ columns++; ++ } ++ ++ /* now scale the rows we just downsampled in the y direction */ ++ downsample_columns_box_filter (width, start_coverage_y, pixel_coverage_y, temp_buf, dest); ++ dest += dst_stride / 4; ++ ++// assert(width*columns <= ((orig_height + scaled_height-1)/scaled_height+1) * width); ++ } ++// assert (src_y<=orig_height); ++ ++ retval = gTrue; ++ ++cleanup: ++ free (x_coverage); ++ free (y_coverage); ++ free (temp_buf); ++ ++ return gTrue; ++} +diff -Nur -x '*.orig' -x '*~' poppler/poppler/CairoRescaleBox.h poppler.new/poppler/CairoRescaleBox.h +--- poppler/poppler/CairoRescaleBox.h 1970-01-01 01:00:00.000000000 +0100 ++++ poppler.new/poppler/CairoRescaleBox.h 2010-03-30 23:22:56.559527323 +0100 +@@ -0,0 +1,12 @@ ++#ifndef CAIRO_RESCALE_BOX_H ++#define CAIRO_RESCALE_BOX_H ++ ++#include "goo/gtypes.h" ++ ++GBool downscale_box_filter(unsigned int *orig, int orig_stride, unsigned orig_width, unsigned orig_height, ++ signed scaled_width, signed scaled_height, ++ unsigned short int start_column, unsigned short int start_row, ++ unsigned short int width, unsigned short int height, ++ unsigned int *dest, int dst_stride); ++ ++#endif /* CAIRO_RESCALE_BOX_H */ +diff -Nur -x '*.orig' -x '*~' poppler/poppler/Makefile.am poppler.new/poppler/Makefile.am +--- poppler/poppler/Makefile.am 2010-03-30 23:08:49.306054000 +0100 ++++ poppler.new/poppler/Makefile.am 2010-03-30 23:22:56.559527323 +0100 +@@ -47,7 +47,9 @@ + CairoFontEngine.cc \ + CairoFontEngine.h \ + CairoOutputDev.cc \ +- CairoOutputDev.h ++ CairoOutputDev.h \ ++ CairoRescaleBox.cc \ ++ CairoRescaleBox.h + + endif + +--- poppler/poppler/Makefile.in 2010-03-31 17:27:06.000000000 +0200 ++++ poppler.new/poppler/Makefile.in 2010-03-31 18:04:59.000000000 +0200 +@@ -1,4 +1,4 @@ +-# Makefile.in generated by automake 1.11 from Makefile.am. ++# Makefile.in generated by automake 1.11.1 from Makefile.am. + # @configure_input@ + + # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +@@ -88,9 +88,11 @@ + @BUILD_POPPLER_QT4_TRUE@@BUILD_SPLASH_OUTPUT_TRUE@am_libpoppler_arthur_la_rpath = + libpoppler_cairo_la_LIBADD = + am__libpoppler_cairo_la_SOURCES_DIST = CairoFontEngine.cc \ +- CairoFontEngine.h CairoOutputDev.cc CairoOutputDev.h ++ CairoFontEngine.h CairoOutputDev.cc CairoOutputDev.h \ ++ CairoRescaleBox.cc CairoRescaleBox.h + @BUILD_CAIRO_OUTPUT_TRUE@am_libpoppler_cairo_la_OBJECTS = \ +-@BUILD_CAIRO_OUTPUT_TRUE@ CairoFontEngine.lo CairoOutputDev.lo ++@BUILD_CAIRO_OUTPUT_TRUE@ CairoFontEngine.lo CairoOutputDev.lo \ ++@BUILD_CAIRO_OUTPUT_TRUE@ CairoRescaleBox.lo + libpoppler_cairo_la_OBJECTS = $(am_libpoppler_cairo_la_OBJECTS) + @BUILD_CAIRO_OUTPUT_TRUE@am_libpoppler_cairo_la_rpath = + am__DEPENDENCIES_1 = +@@ -426,7 +428,9 @@ + @BUILD_CAIRO_OUTPUT_TRUE@ CairoFontEngine.cc \ + @BUILD_CAIRO_OUTPUT_TRUE@ CairoFontEngine.h \ + @BUILD_CAIRO_OUTPUT_TRUE@ CairoOutputDev.cc \ +-@BUILD_CAIRO_OUTPUT_TRUE@ CairoOutputDev.h ++@BUILD_CAIRO_OUTPUT_TRUE@ CairoOutputDev.h \ ++@BUILD_CAIRO_OUTPUT_TRUE@ CairoRescaleBox.cc \ ++@BUILD_CAIRO_OUTPUT_TRUE@ CairoRescaleBox.h + + @BUILD_LIBJPEG_TRUE@libjpeg_sources = \ + @BUILD_LIBJPEG_TRUE@ DCTStream.h \ +@@ -739,6 +743,7 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CMap.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CairoFontEngine.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CairoOutputDev.Plo@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CairoRescaleBox.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Catalog.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CharCodeToUnicode.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DCTStream.Plo@am__quote@ + + --- poppler-0.12.4.orig/debian/patches/11_column_selection.patch +++ poppler-0.12.4/debian/patches/11_column_selection.patch @@ -0,0 +1,1226 @@ +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4/poppler/TextOutputDev.cc poppler-0.12.4.new/poppler/TextOutputDev.cc +--- poppler-0.12.4/poppler/TextOutputDev.cc 2010-01-17 01:06:57.000000000 +0100 ++++ poppler-0.12.4.new/poppler/TextOutputDev.cc 2010-04-19 16:26:07.318097844 +0200 +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + #include + #ifdef _WIN32 + #include // for O_BINARY +@@ -1154,6 +1155,8 @@ + curLine = NULL; + next = NULL; + stackNext = NULL; ++ tableId = -1; ++ tableEnd = gFalse; + } + + TextBlock::~TextBlock() { +@@ -1615,6 +1618,163 @@ + return below; + } + ++GBool TextBlock::isBeforeByRule1(TextBlock *blk1) { ++ GBool before = gFalse; ++ GBool overlap = gFalse; ++ ++ switch (this->page->primaryRot) { ++ case 0: ++ case 2: ++ overlap = ((this->ExMin <= blk1->ExMin) && ++ (blk1->ExMin <= this->ExMax)) || ++ ((blk1->ExMin <= this->ExMin) && ++ (this->ExMin <= blk1->ExMax)); ++ break; ++ case 1: ++ case 3: ++ overlap = ((this->EyMin <= blk1->EyMin) && ++ (blk1->EyMin <= this->EyMax)) || ++ ((blk1->EyMin <= this->EyMin) && ++ (this->EyMin <= blk1->EyMax)); ++ break; ++ } ++ switch (this->page->primaryRot) { ++ case 0: ++ before = overlap && this->EyMin < blk1->EyMin; ++ break; ++ case 1: ++ before = overlap && this->ExMax > blk1->ExMax; ++ break; ++ case 2: ++ before = overlap && this->EyMax > blk1->EyMax; ++ break; ++ case 3: ++ before = overlap && this->ExMin < blk1->ExMin; ++ break; ++ } ++ return before; ++} ++ ++GBool TextBlock::isBeforeByRule2(TextBlock *blk1) { ++ double cmp = 0; ++ int rotLR = rot; ++ ++ if (!page->primaryLR) { ++ rotLR = (rotLR + 2) % 4; ++ } ++ ++ switch (rotLR) { ++ case 0: ++ cmp = ExMax - blk1->ExMin; ++ break; ++ case 1: ++ cmp = EyMin - blk1->EyMax; ++ break; ++ case 2: ++ cmp = blk1->ExMax - ExMin; ++ break; ++ case 3: ++ cmp = blk1->EyMin - EyMax; ++ break; ++ } ++ return cmp <= 0; ++} ++ ++// Sort into reading order by performing a topological sort using the rules ++// given in "High Performance Document Layout Analysis", T.M. Breuel, 2003. ++// See http://pubs.iupr.org/#2003-breuel-sdiut ++// Topological sort is done by depth first search, see ++// http://en.wikipedia.org/wiki/Topological_sorting ++int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1, ++ TextBlock **sorted, int sortPos, ++ GBool* visited) { ++ int pos2; ++ TextBlock *blk1, *blk2, *blk3; ++ GBool before; ++ ++ if (visited[pos1]) { ++ return sortPos; ++ } ++ ++ blk1 = this; ++ ++#if 0 // for debugging ++ printf("visited: %d %.2f..%.2f %.2f..%.2f\n", ++ sortPos, blk1->ExMin, blk1->ExMax, blk1->EyMin, blk1->EyMax); ++#endif ++ visited[pos1] = gTrue; ++ pos2 = -1; ++ for (blk2 = blkList; blk2; blk2 = blk2->next) { ++ pos2++; ++ if (visited[pos2]) { ++ // skip visited nodes ++ continue; ++ } ++ before = gFalse; ++ ++ // is blk2 before blk1? (for table entries) ++ if (blk1->tableId >= 0 && blk1->tableId == blk2->tableId) { ++ if (page->primaryLR) { ++ if (blk2->xMax <= blk1->xMin && ++ blk2->yMin <= blk1->yMax && ++ blk2->yMax >= blk1->yMin) ++ before = gTrue; ++ } else { ++ if (blk2->xMin >= blk1->xMax && ++ blk2->yMin <= blk1->yMax && ++ blk2->yMax >= blk1->yMin) ++ before = gTrue; ++ } ++ ++ if (blk2->yMax <= blk1->yMin) ++ before = gTrue; ++ } else { ++ if (blk2->isBeforeByRule1(blk1)) { ++ // Rule (1) blk1 and blk2 overlap, and blk2 is above blk1. ++ before = gTrue; ++#if 0 // for debugging ++ printf("rule1: %.2f..%.2f %.2f..%.2f %.2f..%.2f %.2f..%.2f\n", ++ blk2->ExMin, blk2->ExMax, blk2->EyMin, blk2->EyMax, ++ blk1->ExMin, blk1->ExMax, blk1->EyMin, blk1->EyMax); ++#endif ++ } else if (blk2->isBeforeByRule2(blk1)) { ++ // Rule (2) blk2 left of blk1, and no intervening blk3 ++ // such that blk1 is before blk3 by rule 1, ++ // and blk3 is before blk2 by rule 1. ++ before = gTrue; ++ for (blk3 = blkList; blk3; blk3 = blk3->next) { ++ if (blk3 == blk2 || blk3 == blk1) { ++ continue; ++ } ++ if (blk1->isBeforeByRule1(blk3) && ++ blk3->isBeforeByRule1(blk2)) { ++ before = gFalse; ++ break; ++ } ++ } ++#if 0 // for debugging ++ if (before) { ++ printf("rule2: %.2f..%.2f %.2f..%.2f %.2f..%.2f %.2f..%.2f\n", ++ blk1->ExMin, blk1->ExMax, blk1->EyMin, blk1->EyMax, ++ blk2->ExMin, blk2->ExMax, blk2->EyMin, blk2->EyMax); ++ } ++#endif ++ } ++ } ++ if (before) { ++ // blk2 is before blk1, so it needs to be visited ++ // before we can add blk1 to the sorted list. ++ sortPos = blk2->visitDepthFirst(blkList, pos2, sorted, sortPos, visited); ++ } ++ } ++#if 0 // for debugging ++ printf("sorted: %d %.2f..%.2f %.2f..%.2f\n", ++ sortPos, blk1->ExMin, blk1->ExMax, blk1->EyMin, blk1->EyMax); ++#endif ++ sorted[sortPos++] = blk1; ++ return sortPos; ++} ++ + //------------------------------------------------------------------------ + // TextFlow + //------------------------------------------------------------------------ +@@ -2183,8 +2343,7 @@ + TextPool *pool; + TextWord *word0, *word1, *word2; + TextLine *line; +- TextBlock *blkList, *blkStack, *blk, *lastBlk, *blk0, *blk1; +- TextBlock **blkArray; ++ TextBlock *blkList, *blk, *lastBlk, *blk0, *blk1, *blk2; + TextFlow *flow, *lastFlow; + TextUnderline *underline; + TextLink *link; +@@ -2194,7 +2353,6 @@ + GBool found; + int count[4]; + int lrCount; +- int firstBlkIdx, nBlocksLeft; + int col1, col2; + int i, j, n; + +@@ -2687,7 +2845,7 @@ + } + } + +-#if 0 // for debugging ++#if 0 // for debugging + printf("*** rotation ***\n"); + for (rot = 0; rot < 4; ++rot) { + printf(" %d: %6d\n", rot, count[rot]); +@@ -2841,9 +2999,6 @@ + + //----- reading order sort + +- // sort blocks into yx order (in preparation for reading order sort) +- qsort(blocks, nBlocks, sizeof(TextBlock *), &TextBlock::cmpYXPrimaryRot); +- + // compute space on left and right sides of each block + for (i = 0; i < nBlocks; ++i) { + blk0 = blocks[i]; +@@ -2856,7 +3011,282 @@ + } + + #if 0 // for debugging +- printf("*** blocks, after yx sort ***\n"); ++ printf("PAGE\n"); ++#endif ++ ++ int sortPos = 0; ++ GBool *visited = (GBool *)gmallocn(nBlocks, sizeof(GBool)); ++ for (i = 0; i < nBlocks; i++) { ++ visited[i] = gFalse; ++ } ++ ++ double bxMin0, byMin0, bxMin1, byMin1; ++ int numTables = 0; ++ int tableId = -1; ++ int correspondenceX, correspondenceY; ++ double xCentre1, yCentre1, xCentre2, yCentre2; ++ double xCentre3, yCentre3, xCentre4, yCentre4; ++ double deltaX, deltaY; ++ TextBlock *fblk2 = NULL, *fblk3 = NULL, *fblk4 = NULL; ++ ++ for (blk1 = blkList; blk1; blk1 = blk1->next) { ++ blk1->ExMin = blk1->xMin; ++ blk1->ExMax = blk1->xMax; ++ blk1->EyMin = blk1->yMin; ++ blk1->EyMax = blk1->yMax; ++ ++ bxMin0 = std::numeric_limits::max(); ++ byMin0 = std::numeric_limits::max(); ++ bxMin1 = std::numeric_limits::max(); ++ byMin1 = std::numeric_limits::max(); ++ ++ fblk2 = NULL; ++ fblk3 = NULL; ++ fblk4 = NULL; ++ ++ /* find fblk2, fblk3 and fblk4 so that ++ * fblk2 is on the right of blk1 and overlap with blk1 in y axis ++ * fblk3 is under blk1 and overlap with blk1 in x axis ++ * fblk4 is under blk1 and on the right of blk1 ++ * and they are closest to blk1 ++ */ ++ for (blk2 = blkList; blk2; blk2 = blk2->next) { ++ if (blk2 != blk1) { ++ if (blk2->yMin <= blk1->yMax && ++ blk2->yMax >= blk1->yMin && ++ blk2->xMin > blk1->xMax && ++ blk2->xMin < bxMin0) { ++ bxMin0 = blk2->xMin; ++ fblk2 = blk2; ++ } else if (blk2->xMin <= blk1->xMax && ++ blk2->xMax >= blk1->xMin && ++ blk2->yMin > blk1->yMax && ++ blk2->yMin < byMin0) { ++ byMin0 = blk2->yMin; ++ fblk3 = blk2; ++ } else if (blk2->xMin > blk1->xMax && ++ blk2->xMin < bxMin1 && ++ blk2->yMin > blk1->yMax && ++ blk2->yMin < byMin1) { ++ bxMin1 = blk2->xMin; ++ byMin1 = blk2->yMin; ++ fblk4 = blk2; ++ } ++ } ++ } ++ ++ /* fblk4 can not overlap with fblk3 in x and with fblk2 in y ++ * fblk4 has to overlap with fblk3 in y and with fblk2 in x ++ */ ++ if (fblk2 != NULL && ++ fblk3 != NULL && ++ fblk4 != NULL) { ++ if (((fblk3->xMin <= fblk4->xMax && fblk3->xMax >= fblk4->xMin) || ++ (fblk2->yMin <= fblk4->yMax && fblk2->yMax >= fblk4->yMin)) || ++ !(fblk4->xMin <= fblk2->xMax && fblk4->xMax >= fblk2->xMin && ++ fblk4->yMin <= fblk3->yMax && fblk4->yMax >= fblk3->yMin)) { ++ fblk2 = NULL; ++ fblk3 = NULL; ++ fblk4 = NULL; ++ } ++ } ++ ++ // if we found any then look whether they form a table ++ if (fblk2 != NULL && ++ fblk3 != NULL && ++ fblk4 != NULL) { ++ tableId = -1; ++ correspondenceX = 0; ++ correspondenceY = 0; ++ deltaX = 0.0; ++ deltaY = 0.0; ++ ++ if (blk1->lines && blk1->lines->words) ++ deltaX = blk1->lines->words->getFontSize(); ++ if (fblk2->lines && fblk2->lines->words) ++ deltaX = deltaX < fblk2->lines->words->getFontSize() ? ++ deltaX : fblk2->lines->words->getFontSize(); ++ if (fblk3->lines && fblk3->lines->words) ++ deltaX = deltaX < fblk3->lines->words->getFontSize() ? ++ deltaX : fblk3->lines->words->getFontSize(); ++ if (fblk4->lines && fblk4->lines->words) ++ deltaX = deltaX < fblk4->lines->words->getFontSize() ? ++ deltaX : fblk4->lines->words->getFontSize(); ++ ++ deltaY = deltaX; ++ ++ deltaX *= minColSpacing1; ++ deltaY *= maxIntraLineDelta; ++ ++ xCentre1 = (blk1->xMax + blk1->xMin) / 2.0; ++ yCentre1 = (blk1->yMax + blk1->yMin) / 2.0; ++ xCentre2 = (fblk2->xMax + fblk2->xMin) / 2.0; ++ yCentre2 = (fblk2->yMax + fblk2->yMin) / 2.0; ++ xCentre3 = (fblk3->xMax + fblk3->xMin) / 2.0; ++ yCentre3 = (fblk3->yMax + fblk3->yMin) / 2.0; ++ xCentre4 = (fblk4->xMax + fblk4->xMin) / 2.0; ++ yCentre4 = (fblk4->yMax + fblk4->yMin) / 2.0; ++ ++ // are blocks centrally aligned in x ? ++ if (abs (xCentre1 - xCentre3) <= deltaX && ++ abs (xCentre2 - xCentre4) <= deltaX) ++ correspondenceX++; ++ ++ // are blocks centrally aligned in y ? ++ if (abs (yCentre1 - yCentre2) <= deltaY && ++ abs (yCentre3 - yCentre4) <= deltaY) ++ correspondenceY++; ++ ++ // are blocks aligned to the left ? ++ if (abs (blk1->xMin - fblk3->xMin) <= deltaX && ++ abs (fblk2->xMin - fblk4->xMin) <= deltaX) ++ correspondenceX++; ++ ++ // are blocks aligned to the right ? ++ if (abs (blk1->xMax - fblk3->xMax) <= deltaX && ++ abs (fblk2->xMax - fblk4->xMax) <= deltaX) ++ correspondenceX++; ++ ++ // are blocks aligned to the top ? ++ if (abs (blk1->yMin - fblk2->yMin) <= deltaY && ++ abs (fblk3->yMin - fblk4->yMin) <= deltaY) ++ correspondenceY++; ++ ++ // are blocks aligned to the bottom ? ++ if (abs (blk1->yMax - fblk2->yMax) <= deltaY && ++ abs (fblk3->yMax - fblk4->yMax) <= deltaY) ++ correspondenceY++; ++ ++ // are blocks aligned in x and y ? ++ if (correspondenceX > 0 && ++ correspondenceY > 0) { ++ ++ // find maximal tableId ++ tableId = tableId < fblk4->tableId ? fblk4->tableId : tableId; ++ tableId = tableId < fblk3->tableId ? fblk3->tableId : tableId; ++ tableId = tableId < fblk2->tableId ? fblk2->tableId : tableId; ++ tableId = tableId < blk1->tableId ? blk1->tableId : tableId; ++ ++ // if the tableId is -1, then we found new table ++ if (tableId < 0) { ++ tableId = numTables; ++ numTables++; ++ } ++ ++ blk1->tableId = tableId; ++ fblk2->tableId = tableId; ++ fblk3->tableId = tableId; ++ fblk4->tableId = tableId; ++ } ++ } ++ } ++ ++ /* set extended bounding boxes of all table entries ++ * so that they contain whole table ++ * (we need to process whole table size when comparing it ++ * with regular text blocks) ++ */ ++ PDFRectangle *envelopes = new PDFRectangle [numTables]; ++ TextBlock **ending_blocks = new TextBlock* [numTables]; ++ ++ for (i = 0; i < numTables; i++) { ++ envelopes[i].x1 = std::numeric_limits::max(); ++ envelopes[i].x2 = std::numeric_limits::min(); ++ envelopes[i].y1 = std::numeric_limits::max(); ++ envelopes[i].y2 = std::numeric_limits::min(); ++ } ++ ++ for (blk1 = blkList; blk1; blk1 = blk1->next) { ++ if (blk1->tableId >= 0) { ++ if (blk1->ExMin < envelopes[blk1->tableId].x1) { ++ envelopes[blk1->tableId].x1 = blk1->ExMin; ++ if (!blk1->page->primaryLR) ++ ending_blocks[blk1->tableId] = blk1; ++ } ++ ++ if (blk1->ExMax > envelopes[blk1->tableId].x2) { ++ envelopes[blk1->tableId].x2 = blk1->ExMax; ++ if (blk1->page->primaryLR) ++ ending_blocks[blk1->tableId] = blk1; ++ } ++ ++ envelopes[blk1->tableId].y1 = blk1->EyMin < envelopes[blk1->tableId].y1 ? ++ blk1->EyMin : envelopes[blk1->tableId].y1; ++ envelopes[blk1->tableId].y2 = blk1->EyMax > envelopes[blk1->tableId].y2 ? ++ blk1->EyMax : envelopes[blk1->tableId].y2; ++ } ++ } ++ ++ for (blk1 = blkList; blk1; blk1 = blk1->next) { ++ if (blk1->tableId >= 0 && ++ blk1->xMin <= ending_blocks[blk1->tableId]->xMax && ++ blk1->xMax >= ending_blocks[blk1->tableId]->xMin) { ++ blk1->tableEnd = gTrue; ++ } ++ } ++ ++ for (blk1 = blkList; blk1; blk1 = blk1->next) { ++ if (blk1->tableId >= 0) { ++ blk1->ExMin = envelopes[blk1->tableId].x1; ++ blk1->ExMax = envelopes[blk1->tableId].x2; ++ blk1->EyMin = envelopes[blk1->tableId].y1; ++ blk1->EyMax = envelopes[blk1->tableId].y2; ++ } ++ } ++ delete[] envelopes; ++ delete[] ending_blocks; ++ ++ ++ /* set extended bounding boxes of all other blocks ++ * so that they extend in x without hitting neighbours ++ */ ++ for (blk1 = blkList; blk1; blk1 = blk1->next) { ++ if (!blk1->tableId >= 0) { ++ double xMax = std::numeric_limits::max(); ++ double xMin = std::numeric_limits::min(); ++ ++ for (blk2 = blkList; blk2; blk2 = blk2->next) { ++ if (blk2 == blk1) ++ continue; ++ ++ if (blk1->yMin <= blk2->yMax && blk1->yMax >= blk2->yMin) { ++ if (blk2->xMin < xMax && blk2->xMin > blk1->xMax) ++ xMax = blk2->xMin; ++ ++ if (blk2->xMax > xMin && blk2->xMax < blk1->xMin) ++ xMin = blk2->xMax; ++ } ++ } ++ ++ for (blk2 = blkList; blk2; blk2 = blk2->next) { ++ if (blk2 == blk1) ++ continue; ++ ++ if (blk2->xMax > blk1->ExMax && ++ blk2->xMax <= xMax && ++ blk2->yMin >= blk1->yMax) { ++ blk1->ExMax = blk2->xMax; ++ } ++ ++ if (blk2->xMin < blk1->ExMin && ++ blk2->xMin >= xMin && ++ blk2->yMin >= blk1->yMax) ++ blk1->ExMin = blk2->xMin; ++ } ++ } ++ } ++ ++ i = -1; ++ for (blk1 = blkList; blk1; blk1 = blk1->next) { ++ i++; ++ sortPos = blk1->visitDepthFirst(blkList, i, blocks, sortPos, visited); ++ } ++ if (visited) { ++ gfree(visited); ++ } ++ ++#if 0 // for debugging ++ printf("*** blocks, after ro sort ***\n"); + for (i = 0; i < nBlocks; ++i) { + blk = blocks[i]; + printf("block: rot=%d x=%.2f..%.2f y=%.2f..%.2f space=%.2f..%.2f\n", +@@ -2876,44 +3306,34 @@ + } + } + printf("\n"); ++ fflush(stdout); + #endif + + // build the flows + //~ this needs to be adjusted for writing mode (vertical text) + //~ this also needs to account for right-to-left column ordering +- blkArray = (TextBlock **)gmallocn(nBlocks, sizeof(TextBlock *)); +- memcpy(blkArray, blocks, nBlocks * sizeof(TextBlock *)); ++ flow = NULL; + while (flows) { + flow = flows; + flows = flows->next; + delete flow; + } + flows = lastFlow = NULL; +- firstBlkIdx = 0; +- nBlocksLeft = nBlocks; +- while (nBlocksLeft > 0) { +- +- // find the upper-left-most block +- for (; !blkArray[firstBlkIdx]; ++firstBlkIdx) ; +- i = firstBlkIdx; +- blk = blkArray[i]; +- for (j = firstBlkIdx + 1; j < nBlocks; ++j) { +- blk1 = blkArray[j]; +- if (blk1) { +- if (blk && blk->secondaryDelta(blk1) > 0) { +- break; +- } +- if (blk1->primaryCmp(blk) < 0) { +- i = j; +- blk = blk1; +- } ++ // assume blocks are already in reading order, ++ // and construct flows accordingly. ++ for (i = 0; i < nBlocks; i++) { ++ blk = blocks[i]; ++ blk->next = NULL; ++ if (flow) { ++ blk1 = blocks[i - 1]; ++ blkSpace = maxBlockSpacing * blk1->lines->words->fontSize; ++ if (blk1->secondaryDelta(blk) <= blkSpace && ++ blk->isBelow(blk1) && ++ flow->blockFits(blk, blk1)) { ++ flow->addBlock(blk); ++ continue; + } + } +- blkArray[i] = NULL; +- --nBlocksLeft; +- blk->next = NULL; +- +- // create a new flow, starting with the upper-left-most block + flow = new TextFlow(this, blk); + if (lastFlow) { + lastFlow->next = flow; +@@ -2921,56 +3341,7 @@ + flows = flow; + } + lastFlow = flow; +- fontSize = blk->lines->words->fontSize; +- +- // push the upper-left-most block on the stack +- blk->stackNext = NULL; +- blkStack = blk; +- +- // find the other blocks in this flow +- while (blkStack) { +- +- // find the upper-left-most block under (but within +- // maxBlockSpacing of) the top block on the stack +- blkSpace = maxBlockSpacing * blkStack->lines->words->fontSize; +- blk = NULL; +- i = -1; +- for (j = firstBlkIdx; j < nBlocks; ++j) { +- blk1 = blkArray[j]; +- if (blk1) { +- if (blkStack->secondaryDelta(blk1) > blkSpace) { +- break; +- } +- if (blk && blk->secondaryDelta(blk1) > 0) { +- break; +- } +- if (blk1->isBelow(blkStack) && +- (!blk || blk1->primaryCmp(blk) < 0)) { +- i = j; +- blk = blk1; +- } +- } +- } +- +- // if a suitable block was found, add it to the flow and push it +- // onto the stack +- if (blk && flow->blockFits(blk, blkStack)) { +- blkArray[i] = NULL; +- --nBlocksLeft; +- blk->next = NULL; +- flow->addBlock(blk); +- fontSize = blk->lines->words->fontSize; +- blk->stackNext = blkStack; +- blkStack = blk; +- +- // otherwise (if there is no block under the top block or the +- // block is not suitable), pop the stack +- } else { +- blkStack = blkStack->stackNext; +- } +- } + } +- gfree(blkArray); + + #if 0 // for debugging + printf("*** flows ***\n"); +@@ -2980,7 +3351,7 @@ + flow->priMin, flow->priMax); + for (blk = flow->blocks; blk; blk = blk->next) { + printf(" block: rot=%d x=%.2f..%.2f y=%.2f..%.2f pri=%.2f..%.2f\n", +- blk->rot, blk->xMin, blk->xMax, blk->yMin, blk->yMax, ++ blk->rot, blk->ExMin, blk->ExMax, blk->EyMin, blk->EyMax, + blk->priMin, blk->priMax); + for (line = blk->lines; line; line = line->next) { + printf(" line:\n"); +@@ -3521,14 +3892,18 @@ + + GooString *TextSelectionDumper::getText (void) + { +- GBool oneRot = gTrue; + GooString *s; + TextLineFrag *frag; +- int i, col; ++ int i, j; + GBool multiLine; + UnicodeMap *uMap; + char space[8], eol[16]; + int spaceLen, eolLen; ++ GooList *strings = NULL; ++ int actual_table = -1; ++ int actual_line = -1; ++ int last_length = 0; ++ TextBlock *actual_block = NULL; + + s = new GooString(); + +@@ -3541,46 +3916,88 @@ + eolLen = uMap->mapUnicode(0x0a, eol, sizeof(eol)); + + if (nFrags > 0) { +- for (i = 0; i < nFrags; ++i) { +- frags[i].computeCoords(oneRot); +- } +- page->assignColumns(frags, nFrags, oneRot); +- +- // if all lines in the region have the same rotation, use it; +- // otherwise, use the page's primary rotation +- if (oneRot) { +- qsort(frags, nFrags, sizeof(TextLineFrag), +- &TextLineFrag::cmpYXLineRot); +- } else { +- qsort(frags, nFrags, sizeof(TextLineFrag), +- &TextLineFrag::cmpYXPrimaryRot); +- } +- +- col = 0; + multiLine = gFalse; + for (i = 0; i < nFrags; ++i) { + frag = &frags[i]; + +- // insert a return +- if (frag->col < col || +- (i > 0 && fabs(frag->base - frags[i-1].base) > +- maxIntraLineDelta * frags[i-1].line->words->fontSize)) { +- s->append(eol, eolLen); +- col = 0; +- multiLine = gTrue; +- } +- +- // column alignment +- for (; col < frag->col; ++col) { +- s->append(space, spaceLen); +- } +- +- // get the fragment text +- col += page->dumpFragment(frag->line->text + frag->start, frag->len, uMap, s); +- } +- +- if (multiLine) { +- s->append(eol, eolLen); ++ if (actual_table >= 0 && frag->line->blk->tableId < 0) { ++ for (j = 0; j < strings->getLength (); j++) { ++ s->append ((GooString*) strings->get (j)); ++ s->append (eol, eolLen); ++ delete ((GooString*) strings->get (j)); ++ } ++ delete strings; ++ strings = NULL; ++ actual_table = -1; ++ actual_line = -1; ++ actual_block = NULL; ++ } ++ ++ // a table ++ if (frag->line->blk->tableId >= 0) { ++ if (actual_table == -1) { ++ strings = new GooList(); ++ actual_table = frag->line->blk->tableId; ++ actual_block = frag->line->blk; ++ actual_line = -1; ++ } ++ ++ // the same block ++ if (actual_block == frag->line->blk) { ++ actual_line++; ++ if (actual_line >= strings->getLength ()) { ++ GooString *t = new GooString (); ++ // add some spaces to have this block correctly aligned ++ if (actual_line > 0) ++ for (j = 0; j < ((GooString*) (strings->get (actual_line - 1)))->getLength() - last_length - 1; j++) ++ t->append (space, spaceLen); ++ strings->append (t); ++ } ++ } ++ // another block ++ else { ++ // previous block ended its row ++ if (actual_block->tableEnd) { ++ for (j = 0; j < strings->getLength (); j++) { ++ s->append ((GooString*) strings->get (j)); ++ s->append (eol, eolLen); ++ delete ((GooString*) strings->get (j)); ++ } ++ delete strings; ++ ++ strings = new GooList(); ++ GooString *t = new GooString (); ++ strings->append (t); ++ } ++ actual_block = frag->line->blk; ++ actual_line = 0; ++ } ++ ++ page->dumpFragment(frag->line->text + frag->start, frag->len, uMap, ((GooString*) strings->get (actual_line))); ++ last_length = frag->len; ++ ++ if (!frag->line->blk->tableEnd) { ++ ((GooString*) strings->get (actual_line))->append (space, spaceLen); ++ } ++ } ++ // not a table ++ else { ++ page->dumpFragment (frag->line->text + frag->start, frag->len, uMap, s); ++ s->append (eol, eolLen); ++ } ++ } ++ ++ if (strings != NULL) { ++ for (j = 0; j < strings->getLength (); j++) { ++ s->append((GooString*) strings->get (j)); ++ s->append(eol, eolLen); ++ delete ((GooString*) strings->get (j)); ++ } ++ delete strings; ++ strings = NULL; ++ actual_table = -1; ++ actual_line = -1; ++ actual_block = NULL; + } + } + +@@ -3810,14 +4227,28 @@ + end = NULL; + current = NULL; + for (p = words; p != NULL; p = p->next) { +- if ((selection->x1 < p->xMax && selection->y1 < p->yMax) || +- (selection->x2 < p->xMax && selection->y2 < p->yMax)) +- if (begin == NULL) +- begin = p; +- if (((selection->x1 > p->xMin && selection->y1 > p->yMin) || +- (selection->x2 > p->xMin && selection->y2 > p->yMin)) && (begin != NULL)) { +- end = p->next; +- current = p; ++ if (blk->page->primaryLR) { ++ if ((selection->x1 < p->xMax && selection->y1 < p->yMax) || ++ (selection->x2 < p->xMax && selection->y2 < p->yMax)) ++ if (begin == NULL) ++ begin = p; ++ ++ if (((selection->x1 > p->xMin && selection->y1 > p->yMin) || ++ (selection->x2 > p->xMin && selection->y2 > p->yMin)) && (begin != NULL)) { ++ end = p->next; ++ current = p; ++ } ++ } else { ++ if ((selection->x1 > p->xMin && selection->y1 < p->yMax) || ++ (selection->x2 > p->xMin && selection->y2 < p->yMax)) ++ if (begin == NULL) ++ begin = p; ++ ++ if (((selection->x1 < p->xMax && selection->y1 > p->yMin) || ++ (selection->x2 < p->xMax && selection->y2 > p->yMin)) && (begin != NULL)) { ++ end = p->next; ++ current = p; ++ } + } + } + +@@ -3859,75 +4290,112 @@ + void TextBlock::visitSelection(TextSelectionVisitor *visitor, + PDFRectangle *selection, + SelectionStyle style) { +- TextLine *p, *begin, *end; + PDFRectangle child_selection; +- double start_x, start_y, stop_x, stop_y; +- +- begin = NULL; +- end = NULL; +- start_x = selection->x1; +- start_y = selection->y1; +- stop_x = selection->x2; +- stop_y = selection->y2; +- +- for (p = lines; p != NULL; p = p->next) { +- if (selection->x1 < p->xMax && selection->y1 < p->yMax && +- selection->x2 < p->xMax && selection->y2 < p->yMax && begin == NULL) { +- begin = p; +- if (selection->x1 < selection->x2) { +- start_x = selection->x1; +- start_y = selection->y1; +- stop_x = selection->x2; +- stop_y = selection->y2; ++ double x[2], y[2], d, best_d[2]; ++ TextLine *p, *best_line[2]; ++ int i, count = 0, best_count[2], start, stop; ++ GBool all[2]; ++ ++ x[0] = selection->x1; ++ y[0] = selection->y1; ++ x[1] = selection->x2; ++ y[1] = selection->y2; ++ ++ for (i = 0; i < 2; i++) { ++ // the first/last lines are often not nearest ++ // the corners, so we have to force them to be ++ // selected when the selection runs outside this ++ // block. ++ if (page->primaryLR) { ++ all[i] = x[i] >= this->xMax && y[i] >= this->yMax; ++ if (x[i] <= this->xMin && y[i] <= this->yMin) { ++ best_line[i] = this->lines; ++ best_count[i] = 1; ++ } else { ++ best_line[i] = NULL; ++ best_count[i] = 0; ++ } ++ } else { ++ all[i] = x[i] <= this->xMin && y[i] >= this->yMax; ++ if (x[i] >= this->xMax && y[i] <= this->yMin) { ++ best_line[i] = this->lines; ++ best_count[i] = 1; + } else { +- start_x = selection->x2; +- start_y = selection->y2; +- stop_x = selection->x1; +- stop_y = selection->y1; +- } +- } else if (selection->x1 < p->xMax && selection->y1 < p->yMax && begin == NULL) { +- begin = p; +- start_x = selection->x1; +- start_y = selection->y1; +- stop_x = selection->x2; +- stop_y = selection->y2; +- } else if (selection->x2 < p->xMax && selection->y2 < p->yMax && begin == NULL) { +- begin = p; +- start_x = selection->x2; +- start_y = selection->y2; +- stop_x = selection->x1; +- stop_y = selection->y1; +- } +- +- if (((selection->x1 > p->xMin && selection->y1 > p->yMin) || +- (selection->x2 > p->xMin && selection->y2 > p->yMin)) +- && (begin != NULL)) +- end = p->next; ++ best_line[i] = NULL; ++ best_count[i] = 0; ++ } ++ } ++ best_d[i] = 0; + } + +- /* Skip empty selection. */ +- if (end == begin) ++ // find the nearest line to the selection points ++ // using the manhattan distance. ++ for (p = this->lines; p; p = p->next) { ++ count++; ++ for (i = 0; i < 2; i++) { ++ d = fmax(p->xMin - x[i], 0.0) + ++ fmax(x[i] - p->xMax, 0.0) + ++ fmax(p->yMin - y[i], 0.0) + ++ fmax(y[i] - p->yMax, 0.0); ++ if (!best_line[i] || all[i] || ++ d < best_d[i]) { ++ best_line[i] = p; ++ best_count[i] = count; ++ best_d[i] = d; ++ } ++ } ++ } ++ // assert: best is always set. ++ if (!best_line[0] || !best_line[1]) { + return; ++ } ++ ++ // Now decide which point was first. ++ if (best_count[0] < best_count[1] || ++ (best_count[0] == best_count[1] && ++ y[0] < y[1])) { ++ start = 0; ++ stop = 1; ++ } else { ++ start = 1; ++ stop = 0; ++ } + +- visitor->visitBlock (this, begin, end, selection); ++ visitor->visitBlock(this, best_line[start], best_line[stop], selection); + +- for (p = begin; p != end; p = p->next) { +- if (p == begin && style != selectionStyleLine) { +- child_selection.x1 = start_x; +- child_selection.y1 = start_y; ++ for (p = best_line[start]; p; p = p->next) { ++ if (page->primaryLR) { ++ child_selection.x1 = p->xMin; ++ child_selection.x2 = p->xMax; + } else { +- child_selection.x1 = 0; +- child_selection.y1 = 0; ++ child_selection.x1 = p->xMax; ++ child_selection.x2 = p->xMin; + } +- if (p->next == end && style != selectionStyleLine) { +- child_selection.x2 = stop_x; +- child_selection.y2 = stop_y; ++ child_selection.y1 = p->yMin; ++ child_selection.y2 = p->yMax; ++ if (style == selectionStyleLine) { ++ if (p == best_line[start]) { ++ child_selection.x1 = 0; ++ child_selection.y1 = 0; ++ } ++ if (p == best_line[stop]) { ++ child_selection.x2 = page->pageWidth; ++ child_selection.y2 = page->pageHeight; ++ } + } else { +- child_selection.x2 = page->pageWidth; +- child_selection.y2 = page->pageHeight; ++ if (p == best_line[start]) { ++ child_selection.x1 = fmax(p->xMin, fmin(p->xMax, x[start])); ++ child_selection.y1 = fmax(p->yMin, fmin(p->yMax, y[start])); ++ } ++ if (p == best_line[stop]) { ++ child_selection.x2 = fmax(p->xMin, fmin(p->xMax, x[stop])); ++ child_selection.y2 = fmax(p->yMin, fmin(p->yMax, y[stop])); ++ } + } +- + p->visitSelection(visitor, &child_selection, style); ++ if (p == best_line[stop]) { ++ return; ++ } + } + } + +@@ -3935,73 +4403,122 @@ + PDFRectangle *selection, + SelectionStyle style) + { +- int i, begin, end; + PDFRectangle child_selection; +- double start_x, start_y, stop_x, stop_y; +- TextBlock *b; ++ double x[2], y[2], d, best_d[2]; ++ double xMin, yMin, xMax, yMax; ++ TextFlow *flow, *best_flow[2]; ++ TextBlock *blk, *best_block[2]; ++ int i, count = 0, best_count[2], start, stop; + +- begin = nBlocks; +- end = 0; +- start_x = selection->x1; +- start_y = selection->y1; +- stop_x = selection->x2; +- stop_y = selection->y2; ++ if (!flows) ++ return; + +- for (i = 0; i < nBlocks; i++) { +- b = blocks[i]; ++ x[0] = selection->x1; ++ y[0] = selection->y1; ++ x[1] = selection->x2; ++ y[1] = selection->y2; ++ ++ xMin = pageWidth; ++ yMin = pageHeight; ++ xMax = 0.0; ++ yMax = 0.0; ++ ++ for (i = 0; i < 2; i++) { ++ best_block[i] = NULL; ++ best_flow[i] = NULL; ++ best_count[i] = 0; ++ best_d[i] = 0; ++ } + +- if (selection->x1 < b->xMax && selection->y1 < b->yMax && +- selection->x2 < b->xMax && selection->y2 < b->yMax && i < begin) { +- begin = i; +- if (selection->y1 < selection->y2) { +- start_x = selection->x1; +- start_y = selection->y1; +- stop_x = selection->x2; +- stop_y = selection->y2; +- } else { +- start_x = selection->x2; +- start_y = selection->y2; +- stop_x = selection->x1; +- stop_y = selection->y1; +- } +- } else if (selection->x1 < b->xMax && selection->y1 < b->yMax && i < begin) { +- begin = i; +- start_x = selection->x1; +- start_y = selection->y1; +- stop_x = selection->x2; +- stop_y = selection->y2; +- } else if (selection->x2 < b->xMax && selection->y2 < b->yMax && i < begin) { +- begin = i; +- start_x = selection->x2; +- start_y = selection->y2; +- stop_x = selection->x1; +- stop_y = selection->y1; ++ // find the nearest blocks to the selection points ++ // using the manhattan distance. ++ for (flow = flows; flow; flow = flow->next) { ++ for (blk = flow->blocks; blk; blk = blk->next) { ++ count++; ++ // the first/last blocks in reading order are ++ // often not the closest to the page corners; ++ // track the corners, force those blocks to ++ // be selected if the selection runs across ++ // multiple pages. ++ xMin = fmin(xMin, blk->xMin); ++ yMin = fmin(yMin, blk->yMin); ++ xMax = fmax(xMax, blk->xMax); ++ yMax = fmax(yMax, blk->yMax); ++ for (i = 0; i < 2; i++) { ++ d = fmax(blk->xMin - x[i], 0.0) + ++ fmax(x[i] - blk->xMax, 0.0) + ++ fmax(blk->yMin - y[i], 0.0) + ++ fmax(y[i] - blk->yMax, 0.0); ++ if (!best_block[i] || ++ d < best_d[i] || ++ (!blk->next && !flow->next && ++ x[i] > xMax && y[i] > yMax)) { ++ best_block[i] = blk; ++ best_flow[i] = flow; ++ best_count[i] = count; ++ best_d[i] = d; ++ } ++ } ++ } ++ } ++ for (i = 0; i < 2; i++) { ++ if (primaryLR) { ++ if (x[i] < xMin && y[i] < yMin) { ++ best_block[i] = flows->blocks; ++ best_flow[i] = flows; ++ best_count[i] = 1; ++ } ++ } else { ++ if (x[i] > xMax && y[i] < yMin) { ++ best_block[i] = flows->blocks; ++ best_flow[i] = flows; ++ best_count[i] = 1; ++ } + } ++ } ++ // assert: best is always set. ++ if (!best_block[0] || !best_block[1]) { ++ return; ++ } + +- if ((selection->x1 > b->xMin && selection->y1 > b->yMin) || +- (selection->x2 > b->xMin && selection->y2 > b->yMin)) +- end = i + 1; ++ // Now decide which point was first. ++ if (best_count[0] < best_count[1] || ++ (best_count[0] == best_count[1] && y[0] < y[1])) { ++ start = 0; ++ stop = 1; ++ } else { ++ start = 1; ++ stop = 0; + } + +- for (i = begin; i < end; i++) { +- if (blocks[i]->xMin < start_x && start_x < blocks[i]->xMax && +- blocks[i]->yMin < start_y && start_y < blocks[i]->yMax) { +- child_selection.x1 = start_x; +- child_selection.y1 = start_y; ++ for (flow = best_flow[start]; flow; flow = flow->next) { ++ if (flow == best_flow[start]) { ++ blk = best_block[start]; + } else { +- child_selection.x1 = 0; +- child_selection.y1 = 0; ++ blk = flow->blocks; + } +- if (blocks[i]->xMin < stop_x && stop_x < blocks[i]->xMax && +- blocks[i]->yMin < stop_y && stop_y < blocks[i]->yMax) { +- child_selection.x2 = stop_x; +- child_selection.y2 = stop_y; +- } else { +- child_selection.x2 = pageWidth; +- child_selection.y2 = pageHeight; ++ for (; blk; blk = blk->next) { ++ if (primaryLR) { ++ child_selection.x1 = blk->xMin; ++ child_selection.x2 = blk->xMax; ++ } else { ++ child_selection.x1 = blk->xMax; ++ child_selection.x2 = blk->xMin; ++ } ++ child_selection.y1 = blk->yMin; ++ child_selection.y2 = blk->yMax; ++ if (blk == best_block[start]) { ++ child_selection.x1 = fmax(blk->xMin, fmin(blk->xMax, x[start])); ++ child_selection.y1 = fmax(blk->yMin, fmin(blk->yMax, y[start])); ++ } ++ if (blk == best_block[stop]) { ++ child_selection.x2 = fmax(blk->xMin, fmin(blk->xMax, x[stop])); ++ child_selection.y2 = fmax(blk->yMin, fmin(blk->yMax, y[stop])); ++ blk->visitSelection(visitor, &child_selection, style); ++ return; ++ } ++ blk->visitSelection(visitor, &child_selection, style); + } +- +- blocks[i]->visitSelection(visitor, &child_selection, style); + } + } + +@@ -4286,24 +4803,13 @@ + dumpFragment(line->text, n, uMap, s); + (*outputFunc)(outputStream, s->getCString(), s->getLength()); + delete s; +- if (!line->hyphenated) { +- if (line->next) { +- (*outputFunc)(outputStream, space, spaceLen); +- } else if (blk->next) { +- //~ this is a bit of a kludge - we should really do a more +- //~ intelligent determination of paragraphs +- if (blk->next->lines->words->fontSize == +- blk->lines->words->fontSize) { +- (*outputFunc)(outputStream, space, spaceLen); +- } else { +- (*outputFunc)(outputStream, eol, eolLen); +- } +- } ++ // output a newline when a hyphen is not suppressed ++ if (n == line->len) { ++ (*outputFunc)(outputStream, eol, eolLen); + } + } + } + (*outputFunc)(outputStream, eol, eolLen); +- (*outputFunc)(outputStream, eol, eolLen); + } + } + +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4/poppler/TextOutputDev.h poppler-0.12.4.new/poppler/TextOutputDev.h +--- poppler-0.12.4/poppler/TextOutputDev.h 2010-01-17 01:06:57.000000000 +0100 ++++ poppler-0.12.4.new/poppler/TextOutputDev.h 2010-04-19 16:26:07.318097844 +0200 +@@ -361,11 +361,23 @@ + + private: + ++ GBool isBeforeByRule1(TextBlock *blk1); ++ GBool isBeforeByRepeatedRule1(TextBlock *blkList, TextBlock *blk1); ++ GBool isBeforeByRule2(TextBlock *blk1); ++ ++ int visitDepthFirst(TextBlock *blkList, int pos1, ++ TextBlock **sorted, int sortPos, ++ GBool* visited); ++ + TextPage *page; // the parent page + int rot; // text rotation + double xMin, xMax; // bounding box x coordinates + double yMin, yMax; // bounding box y coordinates + double priMin, priMax; // whitespace bounding box along primary axis ++ double ExMin, ExMax; // extended bounding box x coordinates ++ double EyMin, EyMax; // extended bounding box y coordinates ++ int tableId; // id of table to which this block belongs ++ GBool tableEnd; // is this block at end of line of actual table + + TextPool *pool; // pool of words (used only until lines + // are built) +@@ -385,6 +397,7 @@ + friend class TextWordList; + friend class TextPage; + friend class TextSelectionPainter; ++ friend class TextSelectionDumper; + }; + + //------------------------------------------------------------------------ --- poppler-0.12.4.orig/debian/patches/psname-escape-backslash.patch +++ poppler-0.12.4/debian/patches/psname-escape-backslash.patch @@ -0,0 +1,20 @@ +From 7c3140c88c00282e10888143fffe3c402d48fb05 Mon Sep 17 00:00:00 2001 +From: Adrian Johnson +Date: Sat, 27 Feb 2010 12:13:47 +0000 +Subject: Don't use '\' character in PostScript names + +Origin: Upstream git, in 0.13.1. +Bug: https://bugs.freedesktop.org/show_bug.cgi?id=26776 +Bug-Ubuntu: https://launchpad.net/bugs/404214 +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4/poppler/PSOutputDev.cc poppler-0.12.4.new/poppler/PSOutputDev.cc +--- poppler-0.12.4/poppler/PSOutputDev.cc 2010-03-19 13:54:14.202817804 +0100 ++++ poppler-0.12.4.new/poppler/PSOutputDev.cc 2010-03-19 13:54:15.202802300 +0100 +@@ -6483,7 +6483,7 @@ + if (c <= (char)0x20 || c >= (char)0x7f || + c == '(' || c == ')' || c == '<' || c == '>' || + c == '[' || c == ']' || c == '{' || c == '}' || +- c == '/' || c == '%') { ++ c == '/' || c == '%' || c == '\\') { + writePSFmt("#{0:02x}", c & 0xff); + } else { + writePSChar(c); --- poppler-0.12.4.orig/debian/patches/CVE-2010-3704.patch +++ poppler-0.12.4/debian/patches/CVE-2010-3704.patch @@ -0,0 +1,16 @@ +Description: fix possible arbitrary code execution via malformed PDF +Origin: backport, http://cgit.freedesktop.org/poppler/poppler/commit/?id=39d140bfc0b8239bdd96d6a55842034ae5c05473 +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=599165 + +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4//fofi/FoFiType1.cc poppler-0.12.4.new//fofi/FoFiType1.cc +--- poppler-0.12.4//fofi/FoFiType1.cc 2010-01-16 19:06:57.000000000 -0500 ++++ poppler-0.12.4.new//fofi/FoFiType1.cc 2010-10-13 15:50:17.000000000 -0400 +@@ -241,7 +242,7 @@ + code = code * 8 + (*p2 - '0'); + } + } +- if (code < 256) { ++ if (code < 256 && code >= 0) { + for (p = p2; *p == ' ' || *p == '\t'; ++p) ; + if (*p == '/') { + ++p; --- poppler-0.12.4.orig/debian/patches/CVE-2010-3703.patch +++ poppler-0.12.4/debian/patches/CVE-2010-3703.patch @@ -0,0 +1,15 @@ +Description: fix possible arbitrary code execution via malformed PDF +Origin: upstream, http://cgit.freedesktop.org/poppler/poppler/commit/?id=bf2055088a3a2d3bb3d3c37d464954ec1a25771f +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=599165 + +diff -Nur -x '*.orig' -x '*~' poppler-0.12.4//poppler/Function.cc poppler-0.12.4.new//poppler/Function.cc +--- poppler-0.12.4//poppler/Function.cc 2010-01-16 19:06:57.000000000 -0500 ++++ poppler-0.12.4.new//poppler/Function.cc 2010-10-13 15:50:08.000000000 -0400 +@@ -1106,6 +1106,7 @@ + code = NULL; + codeString = NULL; + codeSize = 0; ++ stack = NULL; + ok = gFalse; + cache = new PopplerCache(5); + --- poppler-0.12.4.orig/debian/patches/backport-rotation-scaling.patch +++ poppler-0.12.4/debian/patches/backport-rotation-scaling.patch @@ -0,0 +1,65 @@ +Subject: [cairo] Fix downscaling images when document is rotated + +Fixes bug #26264. +--- +diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc +index 5ca86b8..a2a9ae5 100644 +--- a/poppler/CairoOutputDev.cc ++++ b/poppler/CairoOutputDev.cc +@@ -1344,6 +1344,30 @@ void CairoOutputDev::endMaskClip(GfxState *state) { + clearSoftMask(state); + } + ++/* Taken from cairo/doc/tutorial/src/singular.c */ ++static void ++get_singular_values (const cairo_matrix_t *matrix, ++ double *major, ++ double *minor) ++{ ++ double xx = matrix->xx, xy = matrix->xy; ++ double yx = matrix->yx, yy = matrix->yy; ++ ++ double a = xx*xx+yx*yx; ++ double b = xy*xy+yy*yy; ++ double k = xx*xy+yx*yy; ++ ++ double f = (a+b) * .5; ++ double g = (a-b) * .5; ++ double delta = sqrt (g*g + k*k); ++ ++ if (major) ++ *major = sqrt (f + delta); ++ if (minor) ++ *minor = sqrt (f - delta); ++} ++ ++ + cairo_surface_t *CairoOutputDev::downscaleSurface(cairo_surface_t *orig_surface) { + cairo_surface_t *dest_surface; + unsigned char *dest_buffer; +@@ -1356,12 +1380,21 @@ cairo_surface_t *CairoOutputDev::downscaleSurface(cairo_surface_t *orig_surface) + if (printing) + return NULL; + ++ ++ orig_width = cairo_image_surface_get_width (orig_surface); ++ orig_height = cairo_image_surface_get_height (orig_surface); ++ + cairo_matrix_t matrix; + cairo_get_matrix(cairo, &matrix); + + /* this whole computation should be factored out */ +- double xScale = matrix.xx; +- double yScale = matrix.yy; ++ double xScale; ++ double yScale; ++ if (orig_width > orig_height) ++ get_singular_values (&matrix, &xScale, &yScale); ++ else ++ get_singular_values (&matrix, &yScale, &xScale); ++ + int tx, tx2, ty, ty2; /* the integer co-oridinates of the resulting image */ + int scaledHeight; + int scaledWidth; + +