NOTICE! This is a static HTML version of a legacy LOCI Software ticket.

LOCI projects are now located on GitHub. The Bio-Formats project can be found here.

Ticket #415 (closed defect: fixed)

Opened 2009-09-28T19:05:41-05:00

Last modified 2009-10-12T10:53:09-05:00

Lossless JPEG codec performs invalid bit operations

Reported by: curtis Owned by: melissa
Priority: major Milestone: bio-formats-4.1
Component: bio-formats Severity: major
Keywords: Cc: Mack.Gardner-Morse@…
Blocked By: Blocking:


Sometimes the lossless JPEG codec attempts to extract a negative number of bits from a data stream, which the bit buffer engine does not support. E.g.:

curtis@monk:~/data/dicom/mack$ showinf IM-0001-0068.dcm -nocore -nometa
Checking file format [DICOM]
Initializing reader
	Verifying DICOM format
	Reading tags
	Calculating image offsets
	Building file list
	Populating metadata
Initialization took 0.461s

Reading pixel data (0-0) Exception in thread "main" java.lang.IllegalArgumentException: Bits to read may not be negative
	at loci.formats.codec.BitBuffer.getBits(
	at loci.formats.codec.HuffmanCodec.getSample(
	at loci.formats.codec.LosslessJPEGCodec.decompress(
	at loci.formats.codec.JPEGCodec.decompress(
	at loci.formats.codec.BaseCodec.decompress(
	at loci.formats.FormatReader.openBytes(
	at loci.formats.ImageReader.openBytes(
	at loci.formats.ReaderWrapper.openBytes(
	at loci.formats.gui.BufferedImageReader.openImage(

Change History

comment:1 Changed 2009-10-12T10:53:09-05:00 by melissa

  • Status changed from new to closed
  • Resolution set to fixed

(In [5580]) Fixed bit reading problem in Huffman codec. Closes #415.