[PATCH] cfgfile: fix isspace() undefined behavior
Dumitrescu, Cristian
cristian.dumitrescu at intel.com
Thu Nov 5 11:12:17 CET 2026
> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson at intel.com>
> Sent: Thursday, November 5, 2026 9:33 AM
> To: Wei Chen <allen.chen at jaguarmicro.com>
> Cc: dev at dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu at intel.com>;
> stable at dpdk.org
> Subject: Re: [PATCH] cfgfile: fix isspace() undefined behavior
>
> On Thu, Oct 22, 2026 at 08:23:48PM +0800, Wei Chen wrote:
> > The _strip() function passes a char directly to isspace(), which is
> > undefined behavior. The ctype functions require an int argument that is
> > either an unsigned char value or EOF, but char is signed by default on
> > x86 and ARM, so any byte >= 0x80 in the input is promoted to a negative
> > int and indexes the ctype table out of bounds.
> >
> > Such bytes are reachable from a user-provided config file containing
> > UTF-8 or other non-ASCII content.
> >
> > Cast the argument to unsigned char, as is already done in
> > app/test-bbdev/test_bbdev_vector.c and elsewhere.
> >
> > Fixes: eaafbad419bf ("cfgfile: library to interpret config files")
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Wei Chen <allen.chen at jaguarmicro.com>
> > ---
> > lib/cfgfile/rte_cfgfile.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> Acked-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
More information about the stable
mailing list