Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 24 Feb 2023 15:07:19 -0500
From: Rich Felker <>
To: Jₑₙₛ Gustedt <>
Cc: Tamir Duberstein <>,,
	NRK <>
Subject: Re: undefined behavior in fread.c

On Fri, Feb 24, 2023 at 05:40:10PM +0100, Jₑₙₛ Gustedt wrote:
> on Fri, 24 Feb 2023 11:12:11 -0500 you (Tamir Duberstein
> <>) wrote:
> > I agree, the caller's behavior is UB. I'll send them (freetype2) a
> > patch.
> > 
> > That said, do we want to avoid internal UB here anyway?
> I am not sure that I even understand what "internal UB" is supposed to mean.
> > - As mentioned earlier, glibc avoids the UB (and the lock).
> > - llvm-libc does the same starting with
> >
> > - uclibc avoids the UB but still locks:
> >
> > - FreeBSD avoids the UB but still locks:
> >
> > - Android (bionic) avoids the UB but still locks:
> >;l=1099;drc=4aa8f499f21ebf84101de34d68682d5388667001
> > 
> > Does this persuade?
> Me personally not much. The only thing that would help applications to
> write portable code is to put an attribute on the pointer argument
> such that bad calls get diagnosed if possible.

Likewise. The recent atol thread seems relevant, where my view was
that it's better to allow the overflow to happen when the caller
invokes UB by passing an argument that overflows, so that a libc built
with sanitizers would naturally cause a trap. The same applies here.
If we make no change, a libc built with sanitizers would automatically
trap when NULL is passed to fread.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.