Skip to content

DasAry_clear() appears to halt buffer refill #17

@cpiker

Description

@cpiker

A Voyager program using DasAry for ragged text storage was getting invalid (false negative)
responses when asking for string data. The call sequence that seems to produce the
results is:

pAry = new_DasAry("myarray", vtByte, 0, NULL, RANK_2(0,0), UNIT_DIMENSIONLESS);

char[...] sLine;
/* Put some data in sLine */
DasAry_append(pAry, (const byte*)sLine, strlen(sLine) + 1);
DasAry_markEnd(pAry, DIM1);

/* Put some more data in sLine */
DasAry_append(pAry, (const byte*)sLine, strlen(sLine) + 1);
DasAry_markEnd(pAry, DIM1);

DasAry_clear(pAry);  /* <-- clear the array, seems to trigger the problem */

/* Put some data in sLine */
DasAry_append(pAry, (const byte*)sLine, strlen(sLine) + 1);

/* Now try to get it, pRet will be NULL even though there should be a string present ! */
size_t uIdx1Bytes;
const char* pRet = (const char*) DasAry_getBytesIn(pAry, DIM1_AT(0), &uIdx1Bytes);

pRet  /* <-- inexplicably NULL! */

The problem was noted in the the 2023-04-17 version of das2C.

The application program could have been corrupting the heap in some manner and the problem might
not be in das2C, but Unittests for this condition should be checked and possibly updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions