Permalink
Browse files

Initial import (0.37)

  • Loading branch information...
0 parents commit 7dca0e67eb2cbe2223aeac3aad515a8f47c33fda jedwin committed Jun 16, 2006
Showing with 49,208 additions and 0 deletions.
  1. +18 −0 AUTHORS
  2. +510 −0 COPYING
  3. BIN ChmLib-ce.zip
  4. BIN ChmLib-ds6.zip
  5. +124 −0 INSTALL
  6. +58 −0 Makefile.in
  7. +58 −0 NEWS
  8. +129 −0 README
  9. +6,737 −0 aclocal.m4
  10. +1,402 −0 config.guess
  11. +750 −0 config.status
  12. +1,477 −0 config.sub
  13. +20,175 −0 configure
  14. +188 −0 configure.in
  15. +251 −0 install-sh
  16. +7,064 −0 libtool
  17. +6,425 −0 ltmain.sh
  18. +50 −0 src/Makefile.simple
  19. +357 −0 src/chm_http.c
  20. +1,930 −0 src/chm_lib.c
  21. +141 −0 src/chm_lib.h
  22. +89 −0 src/enum_chmLib.c
  23. +111 −0 src/enumdir_chmLib.c
  24. +196 −0 src/extract_chmLib.c
  25. +812 −0 src/lzx.c
  26. +62 −0 src/lzx.h
  27. +94 −0 src/test_chmLib.c
18 AUTHORS
@@ -0,0 +1,18 @@
+Jed Wing <jedwin@ugcs.caltech.edu>
+includes modified LZX code from cabextract-0.5 by Stuart Caie.
+
+Thanks to:
+ iDEFENSE for reporting the stack overflow vulnerability.
+ Palasik Sandor for reporting and fixing the LZX buffer overrun vulnerability.
+ David Huseby for enhancements to the chm_enumerate functionality.
+ Vitaly Bursov for compilation fixes for x86-64.
+ Vadim Zeitlin for a patch to clean up and fix some deficiencies in the
+ configure script.
+ Stan Tobias for bugfixes and index-page improvement to chm_http.
+ Andrew Hodgetts for major portability improvement.
+ Rich Erwin for his work towards Windows CE support.
+ Pabs for bug fixes and suggestions.
+ Antony Dovgal for setting up autoconf/automake based build process.
+ Ragnar Hojland Espinosa for patches to make chm_http more useful.
+ Razvan Cojocaru for forwarding along information regarding building on OS X.
+ Anyone else I've forgotten.
510 COPYING

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
124 INSTALL
@@ -0,0 +1,124 @@
+CHMLIB 0.3 Installation
+=======================
+
+-----
+Linux/Unix and Windows (Cygwin)
+-----
+
+I. Relevant options:
+
+ CHM_MT: build library with synchronization for thread-safety
+ CHM_USE_PREAD: use pread instead of lseek/read
+ CHM_USE_IO64: support 64-bit file I/O
+
+ Modify the INSTALLPREFIX to change the installation location.
+
+ Except on platforms where they need to be disabled, I recommend leaving all
+ three options enabled. OS X, however, in particular, seems to need pread
+ and io64 disabled.
+
+II. autoconf/automake-style build
+
+ ./configure [options]
+ make
+ su
+ make install
+
+III. old-style (plain Makefile) build
+
+ cd src
+ <edit Makefile.simple if necessary>
+ make -f Makefile.old
+ su
+ make install
+
+To use the library, see chm_lib.h, and the included example programs:
+
+ test_chmLib.c
+ enum_chmLib.c
+ chm_http.c
+
+-------
+Windows (MSVC++, Win CE SDK)
+-------
+
+I. Relevant options:
+
+ CHM_MT: build library with synchronization for thread-safety
+
+II. Windows Standard Build
+
+ Unzip ChmLib-vs6.zip in the src directory, and open the ChmLib.dsw file in
+ Developer Studio. (This was developed on Developer Studio 6. I don't know
+ if that matters.) You may wish to enable or disable certain features by
+ adding preprocessor defines under the project settings dialog:
+
+ CHM_MT: build library with synchronization for thread-safety
+
+ CHM_MT is enabled by default in the Windows build.
+
+ The resultant library is called chmlib.lib.
+
+ To use the library, see chm_lib.h, and the included example programs:
+
+ test_chmLib.c
+ enum_chmLib.c
+ chm_http.c
+
+ The example programs should also show up in the Visual Studio workspace,
+ except for chm_http. I don't know enough about Windows network programming
+ to try to get that one working. Other than that one, all the other examples
+ run without any problems.
+
+III. Windows CE Build
+
+ Unzip ChmLib-ce.zip in the src directory. I don't know much beyond that,
+ as I have no familiarity with Windows CE, but this should be a good
+ starting point. These project files are from Rich Erwin, who also supplied
+ the necessary code changes to get it running.
+
+Sparc (Solaris)
+---------------
+ Andrew Hodgetts has gotten the library compilable and working on Sparc
+Solaris machines, with CPUs ranging from a Sun4m (Sparc5) up through an
+UltraSparcIII (SunFireV880). He has managed the compilation using both GCC and
+SunProC, although, he notes, some modification to the Makefile was required,
+since SunProC does not understand the -fPIC flag, which GCC uses for Position
+Independent Code.
+
+MIPS (SGI Irix)
+---------------
+ Andrew Hodgetts has gotten the library compilable and working on SGI MIPS
+machines running Irix; this was using only the standard MIPS compiler, not GCC.
+He reported that the -n32 flag was required in the Makefile. He also reported
+that the MIPS compiler was fairly verbose with the warning messages, but that
+the simple examples that came with the library seemed to work.
+
+OS X
+----
+ Apparently, various people have gotten the library compiled for OS X. From
+what I've heard, the secret is to disable pread and io64, and possibly to use
+the 'libtool' from fink, instead of the one included with the standard
+developers kit.
+
+BSD variants
+----
+ I've heard that the library has been compiled on BSD variants. I haven't
+heard of any particular difficulties.
+
+Other Unix variants
+-------------------
+ The code has been written with an eye on portability. Presently, I've only
+personally compiled on Linux and Windows, albeit on a variety of Linux
+configurations, but, as reported above, Andrew Hodgetts has reported successful
+use of the library on both Solaris machines and MIPS machines.. After I get
+version 0.3 out, I may try to get it compiling on some of the machines I have
+at work. This code may or may not compile out of the box with, for instance,
+*BSD or other Unix variants. I welcome any patches that increase the
+portability of this code.
+
+ Platforms that I have access to at work, and may attempt to support after
+version 0.3:
+
+ - AIX
+ - maybe Tru64
@@ -0,0 +1,58 @@
+
+## Available defines for building chm_lib with particular options
+# CHM_MT: build thread-safe version of chm_lib
+# CHM_USE_PREAD: build chm_lib to use pread/pread64 for all I/O
+# CHM_USE_IO64: build chm_lib to support 64-bit file I/O
+#
+# Note: LDFLAGS must contain -lpthread if you are using -DCHM_MT.
+#
+#CFLAGS=-DCHM_MT -DCHM_USE_PREAD -DCHM_USE_IO64
+#CFLAGS=-DCHM_MT -DCHM_USE_PREAD -DCHM_USE_IO64 -g -DDMALLOC_DISABLE
+CFLAGS=@CFLAGS@ @CHM_MT@ @CHM_USE_PREAD@ @CHM_USE_IO64@ @DMALLOC_DISABLE@
+LDFLAGS=@LDFLAGS@
+prefix=@prefix@
+libdir=@libdir@
+exec_prefix=@exec_prefix@
+includedir=@includedir@
+CC=@CC@
+top_builddir=@top_builddir@
+ifeq ($(top_builddir),)
+top_builddir=$(shell pwd)
+endif
+srcdir=@srcdir@
+LIBTOOL=@LIBTOOL@
+EXAMPLES=@EXAMPLES@
+
+all: src/libchm.la
+
+examples: ${EXAMPLES}
+
+src/%.lo: $(srcdir)/src/%.c
+ ${LIBTOOL} --mode=compile ${CC} -c -o $@ $^ ${CFLAGS}
+
+src/libchm.la: src/chm_lib.lo src/lzx.lo
+ ${LIBTOOL} --mode=link ${CC} -o $@ $^ ${LDFLAGS} -rpath $(libdir)
+
+install: src/libchm.la
+ mkdir -p $(DESTDIR)$(prefix) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
+ ${LIBTOOL} --mode=install install -m0755 src/libchm.la $(DESTDIR)$(libdir)/
+ install -m0644 $(srcdir)/src/chm_lib.h $(DESTDIR)$(includedir)/
+
+clean:
+ rm -fr src/libchm.la src/*.o src/*.lo .libs src/.libs src/${EXAMPLES}
+
+test_chmLib: $(srcdir)/src/test_chmLib.c
+ ${CC} -o $@ $^ -I$(includedir) -L$(libdir) -lchm ${CFLAGS}
+
+enum_chmLib: $(srcdir)/src/enum_chmLib.c
+ ${CC} -o $@ $^ -I$(includedir) -L$(libdir) -lchm ${CFLAGS}
+
+enumdir_chmLib: $(srcdir)/src/enumdir_chmLib.c
+ ${CC} -o $@ $^ -I$(includedir) -L$(libdir) -lchm ${CFLAGS}
+
+extract_chmLib: $(srcdir)/src/extract_chmLib.c
+ ${CC} -o $@ $^ -I$(includedir) -L$(libdir) -lchm ${CFLAGS}
+
+chm_http: $(srcdir)/src/chm_http.c
+ ${CC} -o $@ $^ -I$(includedir) -L$(libdir) -lchm -lpthread ${CFLAGS}
+
58 NEWS
@@ -0,0 +1,58 @@
+Changes from 0.36 to 0.37
+ - Major security fix for stack overflow vulnerability:
+ http://www.sven-tantau.de/public_files/chmlib/chmlib_20051126.txt
+ - Corrected the broken Makefile.in.
+
+Changes from 0.35 to 0.36
+ - Major security fix (iDEFENSE Security Advisory IDEF1099 - Stack Overflow
+ Vulnerability)
+ - Major security fix from Palasik Sandor (LZX decompression buffer overrun)
+ - Bugfix/enhancement from David Huseby to make the "what" flags to
+ chm_enumerate work correctly, and to pass the flags along to the callback
+ function (via the chmUnitInfo structure) so that the callback doesn't
+ need to re-parse the filename.
+ - Compilation fixes for x86-64 from Vitaly V. Bursov.
+ - Miscellaneous fixes to the configure script, including some significant
+ cleanup by Vadim Zeitlin. The changes from Vadim should also allow the
+ configure script to correctly configure the build on OS X, where it was
+ previously failing to note that pread64 doesn't work.
+ - Minor update to the Makefile.in to do a mkdir before the install, in case
+ the specified INSTALLPREFIX directory is non-existent
+
+Changes from 0.32 to 0.35
+ - UTF-8 filenames, while still not handled correctly, are handled a little
+ more gracefully. That is to say, the library doesn't fail to open files
+ with filenames using characters outside the ASCII subset. I'm very
+ interested in any information as to the "right" way to handle filenames
+ of this sort.
+ - Files not containing a compressed section are handled properly, such as
+ .chw files. These files seem to contain information about compression,
+ but the information is invalid or empty. The library deals gracefully
+ with this now.
+ - Files compressed with different options were not being decompressed
+ properly. In particular, if the "reset interval" for the compressed
+ section was other than 2 block sizes, it could fail to read some of the
+ files.
+ - The caching system was improved slightly, in conjunction with this
+ previous bugfix.
+
+Changes from 0.3 to 0.32:
+ - [Rich Erwin] Minor portability fixes for Windows CE.
+ - [Pabs] Minor bugfix regarding detecting directory entries versus empty files.
+ - [Antony Dovgal] autoconf-based build process
+ - [Ragnar Hojland Espinosa] Feature additions for chm_http:
+ * Use SO_REUSEADDR
+ * Allow --bind= and --port= command line arguments
+ - Simple makefile has been fixed (finally) to use gcc instead of gcc-3.2. (Sorry, everybody!)
+
+Changes from 0.2 to 0.3:
+
+ - initial attempt at portability to Win32.
+ - bugfixes from Stan Tobias:
+ * memory corruption error with caching system
+ * case insensitivity, to match with the Windows semantics
+ - modification to chm_http by Stan Tobias:
+ * when the user requests the page '/', they get a page with links to
+ all of the files in the archive
+ - Andrew Hodgetts has ported the library to Solaris and Irix. See README for details.
+ - Stuart Caie has granted permission to relicense under the LGPL.
129 README
@@ -0,0 +1,129 @@
+CHMLIB 0.37
+===========
+
+-------
+SUMMARY
+-------
+chmlib is a small library designed for accessing MS ITSS files. The ITSS file
+format is used for Microsoft Html Help files (.chm), which have been the
+predominant medium for software documentation from Microsoft during the past
+several years, having superceded the previously used .hlp file format.
+
+Note that this is NOT the same as the OLE structured storage file format used
+by MS Excel, Word, and so on. Instead, it is a different file format which
+fulfills a similar purpose. Both file formats may be accessed via instances
+of the IStorage COM interface, which is essentially an "acts like a
+filesystem" interface.
+
+-------
+FILE FORMAT SUPPORT
+-------
+
+Lookup of files in the archive is supported, and should be relatively quick.
+Reading of files in the archive is also supported.
+Writing is not supported, but may be added in the future.
+
+In terms of support for the ITSS file format, there are a few places in which
+the support provided by this library is not fully general:
+
+1. ITSS files whose names contain UTF-8 characters which are not part of the
+ ASCII subset will not currently be dealt with gracefully. Currently, the
+ filenames are not converted from UTF-8, but are instead returned as-is. I'm
+ very interested in hearing any suggestions as to the "right" way to handle
+ this.
+
+2. Only version 3 ITSS files are supported at present, though some work has
+ gone towards divining the differences between different versions of the
+ file format. It is possible that version 2 ITSS files might work properly
+ with this library, but unconfirmed.
+
+3. Archives larger than 4 GB should be supported just fine, but if they
+ contain files larger than 4GB, this library may break. Fortunately, this
+ seems somewhat unlikely.
+
+If you run into .chm files (or files you suspect are ITSS files) that this
+library doesn't work with, please contact me so I can fix the library.
+
+-------
+PORTABILITY
+-------
+
+This software was originally developed on a Intel x86 Debian Linux machine,
+using gcc 3.0. It has since been compiled on various flavors of RedHat as
+well, and using versions of gcc from 2.95 through 3.2. Basic Win32 support
+should be in this release. (While a port to Win32 may _seem_ like a funny
+idea, given that Windows ships with libraries for CHM access, it turns out that
+Win CE does not; I've gotten a request for a port to Windows CE.)
+
+Chmlib apparently works on OS X, with some tweaks. In particular, disabling
+pread and io64 apparently works.
+
+Finally, Andrew Hodgetts has ported to Solaris and IRIX:
+
+On Monday, 7 Oct 2002, Andrew Hodgetts wrote:
+> Solaris(Sun):
+>
+> I used both SunProC and GCC on the solaris machines to compile. They
+> both worked ok.
+> However, both required -lsocket on the link line of the Makefile or you
+> recieve linking errors.
+>
+> I have this working on CPUs ranging from Sun4m (Sparc5) through to
+> UltraSparcIII (SunFireV880).
+>
+> Irix (SGI):
+>
+> I only testing with the MIPS compiler (not GCC). All worked ok - lots of
+> warning messages, but it always does that.
+
+He further noted that:
+
+> ... for NON GCC compilers, a little tweaking may be required, but nothing too
+> complex. ie SunProC doesn't understand -fPIC for library building. Irix
+> required -n32 (new 32bit libraries) etc. These are things that someone who
+> uses the OS and compiler should be used to dealing with.
+
+-------
+CREDITS
+-------
+
+* Stuart Caie: the LZX decompression code, and for granting permission to
+ re-license under the LGPL.
+
+* Sven Tantau: identification of a stack-overflow security flaw and a quick fix
+ for the problem.
+
+* iDEFENSE Labs: identification of a nasty stack-overflow security flaw
+
+* Palasik Sandor: identification of a potential security flaw in lzx.c as well
+ as a quick fix for the problem
+
+* David Huseby: An excellent patch to the chm_enumerate functionality, relating
+ to the "what" flags, which didn't work entirely correctly before
+
+* Vadim Zeitlin: Configure script cleanup, including an important update to
+ allow detection of platforms where pread64 doesn't work. (OS X)
+
+* Vitaly V. Bursov: Compilation on x86-64.
+
+* mc: A suggestion to add a "mkdir" to the install step.
+
+* Stan Tobias: bugfixes and the added 'index page' feature of chm_http.
+
+* Andrew Hodgetts: porting to Solaris and IRIX, as well as fixing some
+ little-endian biases in the code.
+
+* Rich Erwin: Windows CE support.
+
+* Pabs: bug fixes and suggestions.
+
+* Antony Dovgal: setting up autoconf/automake based build process.
+
+* Ragnar Hojland Espinosa: patches to make chm_http more useful.
+
+* Razvan Cojocaru: forwarding along information regarding building on OS X.
+
+* Julien Lemoine: creating and maintaining the Debian package of chmlib.
+
+* Anyone else I've forgotten. (?)
+
Oops, something went wrong.

0 comments on commit 7dca0e6

Please sign in to comment.