4xm: use the correct logging context

(cherry picked from commit 08859d19b429c522d6494c186656f4a2d3ff8e21)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4xm: K&R formatting cosmetics

(cherry picked from commit e6496ea7e7ea7355167a1ccbe67a7199d446a654)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4xm: refactor fourxm_read_header

Split sound and video tag parsing in separate functions.
(cherry picked from commit e7a44f87d07655ec0cd31c315936931674434340)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/4xm.c
4xm: do not overread while parsing header

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 42d73f7f6bea0ee0f64a3ad4882860ce5b923a11)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4xm: fold last_picture lazy allocation in decode_p_frame

(cherry picked from commit 50ec1db62d977b6e864f315a53c1c580a6d7efa4)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/4xm.c
4xm: forward errors from decode_p_block

Partially mitigate out of memory writes.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit b8b809908ec547b2609dbac24194f4fd2df61aea)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4xm: drop pointless assert

Make sure the value of wlog2 is always between 0 and 3.
(cherry picked from commit 1f0c6075604c271d5627480f1243d22795f9a315)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4xm: reject frames not compatible with the declared version

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 145023f57262d21474e35b4a6069cf95136339d4)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4xm: validate the buffer size before parsing it

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit de2e5777e225e75813daf2373c95e223651fd89a)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
4xm: do not overread the prestream buffer

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit be373cb50d3c411366fec7eef2eb3681abe48f96)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>