This is caused by the check in mysofa_seek (reader.c)
if(offset < 0 || offset >= reader->memory_len) {
However, the call mysofa_seek(reader, 0, SEEK_END) (used, e.g., in superblockRead2or3()) invariably results in offset == reader->memory_len, which appears to be correct for the end-of-file position.
Therefore I think the error check should be
if(offset < 0 || offset > reader->memory_len) {.
With that all unit tests are passing locally (tested on Linux and MacOS).
Since f4ba5014d3202f3ecd1715e3cc8265bd9ed5585d, the unit test 'external' fails with the message
libmysofa/src/tests/check_data.c:50 - CU_FAIL_FATAL("Error reading data.")
This is caused by the check in mysofa_seek (reader.c)
if(offset < 0 || offset >= reader->memory_len) {
However, the call
mysofa_seek(reader, 0, SEEK_END)
(used, e.g., insuperblockRead2or3()
) invariably results inoffset == reader->memory_len
, which appears to be correct for the end-of-file position.Therefore I think the error check should be
if(offset < 0 || offset > reader->memory_len) {
.With that all unit tests are passing locally (tested on Linux and MacOS).