]> git.tuebingen.mpg.de Git - paraslash.git/commit
com_add(): Allow paths and afhi to exceed 64K.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 6 Sep 2015 13:05:30 +0000 (15:05 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 8 Sep 2015 07:41:04 +0000 (09:41 +0200)
commitc74ba0f43d51d561e94ebe6ae171d65e3a9b42d1
treef8a826f52e055d0b418f95f361884a1235a499ce
parent6e0b28e02a1013c019a3225e922b71f913bfbae4
com_add(): Allow paths and afhi to exceed 64K.

The add command has the unnecessary limitation that for each audio
file to be added, the length of the path plus the size of serialized
audio format handler info structure (afhi) must not exceed 64K.

An afhi bigger than that is quite possible, given that it contains
the meta information of the file, for example an ID3v2 tag which can
contain almost unlimited amounts of data. If the 64K limit is exceeded,
all kinds of bad things may happen. So this issue definitely needs
to be addressed.

Specifically, save_add_callback_buffer() must be fixed. In this
function we serialize the data to be passed from the add command
handler to its callback. This includes path, afhi and the chunk table,
which are all variable in size. To cope with variable sizes, the
start of the buffer contains fields in which the offsets are stored
at which afhi and chunk table are located, relative to the start of
the serialized buffer. The problem is that the offset fields are only
16 bit wide, allowing for a maximal size of 64K.

This commit makes the offsets 32 bit wide and reorders them a
bit. Also, the CAB_AUDIO_FORMAT_OFFSET identifier is renamed to
CAB_AUDIO_FORMAT_ID_OFFSET.
aft.c