avcodec/ttaenc: Fix undefined shift

ttaenc contained (1 << unary) - 1 as an argument for a function
expecting an unsigned int. unary can be as big as 31 in this case.
The type of the shift and the whole expression is int, because 1 fits
into an integer, so that the behaviour is undefined if unary == 31
as the result of the shift can't be represented in an int §. Subtraction
by 1 (which makes the result of the whole expression representable in
an int) doesn't change that this is undefined (it usually leads to
signed integer overflow which is undefined, too).

The solution is simple: Make 1 unsigned to change the type of the
whole expression to unsigned int (as the function expects anyway).

Fixes ticket #8153.

§: This of course presupposes the common int range of -2^31..2^31-1

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3ab488a5407f833ecc66e8fa4c537dc4852db720)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
1 file changed
tree: cb464af5989db623d228668fa509d20f2e646f4e
  1. .gitattributes
  2. .gitignore
  3. .travis.yml
  4. CONTRIBUTING.md
  5. COPYING.GPLv2
  6. COPYING.GPLv3
  7. COPYING.LGPLv2.1
  8. COPYING.LGPLv3
  9. CREDITS
  10. Changelog
  11. INSTALL.md
  12. LICENSE.md
  13. MAINTAINERS
  14. Makefile
  15. README.md
  16. RELEASE
  17. RELEASE_NOTES
  18. arch.mak
  19. cmdutils.c
  20. cmdutils.h
  21. cmdutils_common_opts.h
  22. cmdutils_opencl.c
  23. common.mak
  24. compat/
  25. configure
  26. doc/
  27. ffmpeg.c
  28. ffmpeg.h
  29. ffmpeg_cuvid.c
  30. ffmpeg_dxva2.c
  31. ffmpeg_filter.c
  32. ffmpeg_opt.c
  33. ffmpeg_qsv.c
  34. ffmpeg_vaapi.c
  35. ffmpeg_vdpau.c
  36. ffmpeg_videotoolbox.c
  37. ffplay.c
  38. ffprobe.c
  39. ffserver.c
  40. ffserver_config.c
  41. ffserver_config.h
  42. libavcodec/
  43. libavdevice/
  44. libavfilter/
  45. libavformat/
  46. libavresample/
  47. libavutil/
  48. libpostproc/
  49. library.mak
  50. libswresample/
  51. libswscale/
  52. presets/
  53. tests/
  54. tools/
  55. version.sh
README.md

FFmpeg README

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides a mean to alter decoded Audio and Video through chain of filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libswresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • ffmpeg is a command line toolbox to manipulate, convert and stream multimedia content.
  • ffplay is a minimalistic multimedia player.
  • ffprobe is a simple analysis tool to inspect multimedia content.
  • ffserver is a multimedia streaming server for live broadcasts.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Coding examples are available in the doc/examples directory.

License

FFmpeg codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.

Contributing

Patches should be submitted to the ffmpeg-devel mailing list using git format-patch or git send-email. Github pull requests should be avoided because they are not part of our review process and will be ignored.