[FFmpeg-devel] [PATCH 1/4] avcodec/startcode: Use AV_RN due to UBSan warning about unaligned access

Michael Niedermayer michaelni at gmx.at
Fri Feb 21 22:41:59 EET 2020


On Wed, Jan 22, 2020 at 04:25:40PM +0100, Andreas Rheinhardt wrote:
> On Wed, Jan 22, 2020 at 4:23 PM Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 
> > Am Mi., 22. Jan. 2020 um 16:21 Uhr schrieb Andreas Rheinhardt
> > <andreas.rheinhardt at gmail.com>:
> > >
> > > On Wed, Jan 22, 2020 at 4:06 PM Carl Eugen Hoyos <ceffmpeg at gmail.com>
> > wrote:
> > >
> > > > Am Mi., 22. Jan. 2020 um 15:57 Uhr schrieb Andreas Rheinhardt
> > > > <andreas.rheinhardt at gmail.com>:
> > > > >
> > > > > when directly accessing a buffer via a pointer to uint8_t cast to a
> > > > > pointer to uint64_t/uint32_t. This happened only if
> > HAVE_FAST_UNALIGNED
> > > > > was set, so it was ok, but UBSan nevertheless complained about
> > unaligned
> > > > > accesses. So simply use AV_RNxx to read the buffer; this also
> > improves
> > > > > readability.
> > > >
> > > > Is there a speed impact?
> > > >
> > > The assembly produced by both Clang as well as GCC was completely
> > > unchanged (for non-UBSan builds).
> >
> > (on x86?)
> >
> > Yes: x86-64.

are any other architectures affected or is it the same for all major ones?

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Elect your leaders based on what they did after the last election, not
based on what they say before an election.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200221/608568f9/attachment.sig>


More information about the ffmpeg-devel mailing list