Before the add command handler adds a given audio file to the database
it asks the afs process to check whether the file already exists.
The afs process looks for rows in the audio file table with path
and/or hash identical to the given file. If a match is found a
pointer to the matching row is passed from afs to the command handler.
The get_row_pointer_from_result() helper is then called by the command
handler to extract the row pointer from the result returned by afs.
However, this helper incorrectly dereferenced the pointer which caused
the command handler to examine an address rather than the content of
the address to tell whether the file already exists and whether path
or content has changed. This could lead to changed/moved files being
ignored as well as existing files being added again.
This bug was introduced in commit
0a3b9b83, back in 2008.
static int get_row_pointer_from_result(struct osl_object *result, void *private)
{
struct osl_row **row = private;
- *row = result->data;
+ *row = *(struct osl_row **)(result->data);
return 1;
}