]> git.tuebingen.mpg.de Git - paraslash.git/commit
aft: Avoid stale pointer pointer reference.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 2 Feb 2020 15:26:16 +0000 (16:26 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 16 Mar 2020 15:23:55 +0000 (16:23 +0100)
commitbfb0f769d96dee610a25682b3b9c4218bc315b31
tree262d1aba228d38b3894ace2bb7fd9e144c7cf9fe
parente2e1adca824585eeecd091f54955e51212927533
aft: Avoid stale pointer pointer reference.

We can't rely on the ->hash and ->path pointers of struct
status_item_ls_data because they both become stale when the audio
file table gets remapped. This happens for example when a new audio
file is added while another audio file is currently open. A subsequent
addblob command then triggers a re-initialization of the status items,
which reads from the stale pointer location.

This usually results in garbage in the stat output, but can also lead
to a segfault or worse. Avoid this from happening by creating a copy
of the hash and the path.

This bug has been present for a long time. It was hard to debug
because often no invalid memory accesses occur, hence valgrind does
not complain.
aft.c