hoene / libmysofa

Reader for AES SOFA files to get better HRTFs
Other
137 stars 73 forks source link

Loading pretty large SOFA file fails silently - is there a size limit ? #155

Closed the-drunk-coder closed 3 years ago

the-drunk-coder commented 3 years ago

Hi,

we recently created a SOFA file that has 2702 measurements of 8192 samples length, amounting to ~355MB. Pretty large.

Trying to load this SOFA fails with error 10000. There's no debug out that I could relate to the error.

Is there some limit that prevents libmysofa from loading files of this size ?

Best,

petibub commented 3 years ago

Dear Drunk Coder,

can you load one of these: http://sofacoustics.org/data/database/sbsbrir/

Regards, Piotr

hoene commented 3 years ago

Because of various misuse attempts, all variables have some kind of maximal limit based on a typical use patterns.

I assume your HRTF is just another attempt to crash libmysofa?

You may compile libmysofa with the VDEBUG define to see, where it finally fails.

the-drunk-coder commented 3 years ago

@hoene No it was a legit attempt, no "bad" intentions here ... just an experiment with up-sampling that returned a very large SOFA file ...

@petibub the SBSBRIR files don't load either, but there's a difference ...

I compiled with VDEBUG but there's no explicit error or warning, so it's hard to figure out where things go wrong.

The last messages before failure are:

[...]/hdf/dataobject.c:484: data layout 2
[...]/hdf/dataobject.c:521: dimensionality 4
[...]/hdf/dataobject.c:530: CHUNK 8953
[...]/hdf/dataobject.c:533: 541
[...]/hdf/dataobject.c:533: 1
[...]/hdf/dataobject.c:533: 1639
[...]/hdf/dataobject.c:533: 8
hoene commented 3 years ago

@the-drunk-coder You may try to remove or modify the lines

        if (size > 0x10000000)
          return MYSOFA_INVALID_FORMAT; // LCOV_EXCL_LINE

https://github.com/hoene/libmysofa/blob/master/src/hdf/dataobject.c#L546

the-drunk-coder commented 3 years ago

Commented out the two lines, now the file loads (takes a while though). Guess I'll set it to a reasonable limit ...

Thanks !

hoene commented 3 years ago

Fine. Just tell me the new limit here and I will add it to the next version. You may use mysofa_load instead of mysofa_open. Then, the interpolation structures are not precalculated.