avformat/mov: ignore samples overflowing next_root_atom

This fixes #2657.
ISML movies produced by Microsoft Expression Encoder 4 seem to have invalid
sample entries in their trun/tfhd for data tracks. As a result, too much bytes
are read for these tracks to the point that next_root_atom can go out of
buffer, which makes the encoding fail if the input is not seekable.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
lavu/hmac: Add support for SHA-2

Includes HMAC-SHA-224, HMAC-SHA-256, HMAC-SHA-384, and HMAC-SHA-512.
Tested using test vectors from https://tools.ietf.org/html/rfc4231

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
fate: Add test vectors for HMAC SHA and SHA-2

Also replace custom tests for MD5 with those published in RFC 2202

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
g2meet: reset dimensions on header parsing errors
g2meet: more graceful cursor loading
g2meet: do not leak buffers
Merge remote-tracking branch 'qatar/master'

* qatar/master:
  g2meet: do not leak buffers
  g2meet: more graceful cursor loading
  g2meet: reset dimensions on header parsing errors

Conflicts:
	libavcodec/g2meet.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
g2meet: Fix a typo in the height comparison

Signed-off-by: Martin Storsjö <martin@martin.st>
4xm: use the correct logging context
4xm: K&R formatting cosmetics
4xm: refactor fourxm_read_header

Split sound and video tag parsing in separate functions.
4xm: do not overread while parsing header

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
4xm: fold last_picture lazy allocation in decode_p_frame
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
4xm: drop pointless assert

Make sure the value of wlog2 is always between 0 and 3.
4xm: reject frames not compatible with the declared version

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
4xm: validate the buffer size before parsing it

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
4xm: do not overread the prestream buffer

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
4xm: do not overread the source buffer in decode_p_block

Check for out of picture macroblocks before calling mcdc.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
4xm: refactor decode_p_block

Directly return from code 1, 2 and 6 codepaths and simplify the
remaining one to have a single overflow check and a single call to
mcdc.