Opened 10 years ago

Closed 10 years ago

#3517 closed defect (fixed)

NITF: fix read out of buffer for NBPP < 8 and very small block size; fix decoding of NBPP=4

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone:
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: nitf
Cc: warmerdam

Description

A few issues :

  • NITFRasterBand::Unpack() can trigger Valgrind errors about read after allocated buffer when the block size is very small (typically nBlockSize < psImage->nBitsPerSample) and when NBPP=3, 5, 6 or 7 (the algorithm expect that there's enough data to unpack for 8 pixels).
  • The decoding of NBPP=4 uses an obvious wrong bitmask (0x07 instead of 0x0f)
  • NITFReadImageLine() wasn't ready to deal with nBitsPerSample < 8. I've made a few fixes, but I'm not 100% sure about their correctness as I haven't been able to find reference samples

Change History (1)

comment:1 Changed 10 years ago by Even Rouault

Resolution: fixed
Status: newclosed

r19297 /trunk/gdal/frmts/nitf/ (nitfdataset.cpp nitfimage.c): NITF: fix read out of buffer for NBPP < 8 and very small block size; fix decoding of NBPP=4 (#3517)

r19298 /trunk/autotest/gdrivers/nitf.py: NITF: test reading for NBPP < 8 (#3517)

Note: See TracTickets for help on using tickets.