In aft's add_one_audio_file() we set the header len and
the header offset to zero so that the get_file_info()
functions of the audio format handlers that do not use
headers don't need to zero these fields.
However, this is not the right place to do that as para_afh
also calls get_file_info() via compute_afhi() but missed to
clear these fields which leads to a segmentation fault.
Fix this bug by moving the zeroing to compute_afhi().
int compute_afhi(const char *path, char *data, size_t size,
struct afh_info *afhi)
{
- int ret, i, format = guess_audio_format(path);
+ int ret, i, format;
+
+ afhi->header_offset = 0;
+ afhi->header_len = 0;
+ format = guess_audio_format(path);
if (format >= 0) {
ret = afl[format].get_file_info(data, size, afhi);
struct osl_object map, obj = {.data = NULL}, query, result = {.data = NULL};
HASH_TYPE hash[HASH_SIZE];
- afhi.header_offset = 0;
- afhi.header_len = 0;
ret = guess_audio_format(path);
if (ret < 0 && !(pad->flags & ADD_FLAG_ALL))
goto out_free;