Skip to content

readstat_sas7bdat_read: stat/transfer + "padding" causes issues #381

Description

@stone-statai

I have a SAS file that interacts poorly with the following

            if ((shp-page)%8 == 4 && shp + 4 <= page + page_size &&
                    (*(uint32_t *)shp == 0x00000000 ||
                     *(uint32_t *)shp == 0x20202020 ||
                     ctx->vendor != READSTAT_VENDOR_STAT_TRANSFER)) {
                data = shp + 4;
            } else {
                data = shp;
            }

https://github.com/stone-statai/ReadStat/blob/3c68974fbb35c5bf0888fd603cd99b8253477359/src/sas/readstat_sas7bdat_read.c#L1025-L1032

The file is from Stat/Transfer and it happens to have what looks like padding bytes, however they are not. This causes the 4 bytes to be skipped on this page, and my data is truncated.

I'm not sure if there's a good fix. One option maybe to pass a flag to set this behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions