Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#63 IMODE = "B" seg faults when using write caching

Version_2.5
open
Lester Witter
C (54)
5
2010-03-19
2010-03-18
Todd Giles
No

I'm creating a NITF file with multiple bands of image data I have in another raw data file. I am using Band interleaved by Block (i.e. IMODE = "B") but setting the block size to the same size as the image data (i.e. only a single block per band). When I also enabe caching on write (via nitf_ImageWriter_setWriteCaching(...,1) I get a seg fault when trying to write.

I've traced this segfault to line 654 of ImageIO.c:

/*
* Free block buffers if allocated
* This works because of how
* They are allocated
*/
blocks = &(cntlActual->blockIO[0][0]);
for (i = 0;i < cntlActual->nBlockIO;i++)
if ((blocks[i].blockControl.block != NULL)
&& (blocks[i].blockControl.freeFlag))
NITF_FREE(blocks[i].blockControl.block);

It dies on the second free (the pointer is invalid and non-null).

My "workaround" which is ok for now is to just not use caching.

Discussion

  • D. Pressel
    D. Pressel
    2010-03-19

    • assigned_to: nobody --> nitfguy
     
  • Lester Witter
    Lester Witter
    2010-03-26

    Examined library code but could not find the problem.

    Need reproducible test case

    Offered some testing ideas to Todd

    Lester