Lexer: strtoul shall never set endptr to NULL; it should be an error

This commit is contained in:
Maria Matejka 2019-08-17 15:03:09 +02:00
parent cdde3550dc
commit 0c3b8ffe25

View file

@ -169,7 +169,7 @@ WHITE [ \t]
errno = 0; errno = 0;
l = bstrtoul10(yytext, &e); l = bstrtoul10(yytext, &e);
if (e && (*e != ':') || (errno == ERANGE) || (l >> 32)) if (!e || (*e != ':') || (errno == ERANGE) || (l >> 32))
cf_error("ASN out of range"); cf_error("ASN out of range");
if (l >> 16) if (l >> 16)
@ -187,7 +187,7 @@ WHITE [ \t]
errno = 0; errno = 0;
l = bstrtoul10(e+1, &e); l = bstrtoul10(e+1, &e);
if (e && *e || (errno == ERANGE) || (l >> len2)) if (!e || *e || (errno == ERANGE) || (l >> len2))
cf_error("Number out of range"); cf_error("Number out of range");
cf_lval.i64 |= l; cf_lval.i64 |= l;
@ -214,13 +214,13 @@ WHITE [ \t]
errno = 0; errno = 0;
l = bstrtoul10(yytext+2, &e); l = bstrtoul10(yytext+2, &e);
if (e && (*e != ':') || (errno == ERANGE) || (l >> len1)) if (!e || (*e != ':') || (errno == ERANGE) || (l >> len1))
cf_error("ASN out of range"); cf_error("ASN out of range");
cf_lval.i64 |= ((u64) l) << len2; cf_lval.i64 |= ((u64) l) << len2;
errno = 0; errno = 0;
l = bstrtoul10(e+1, &e); l = bstrtoul10(e+1, &e);
if (e && *e || (errno == ERANGE) || (l >> len2)) if (!e || *e || (errno == ERANGE) || (l >> len2))
cf_error("Number out of range"); cf_error("Number out of range");
cf_lval.i64 |= l; cf_lval.i64 |= l;
@ -242,7 +242,7 @@ WHITE [ \t]
errno = 0; errno = 0;
l = bstrtoul10(e, &e); l = bstrtoul10(e, &e);
if (e && *e || (errno == ERANGE) || (l >> 16)) if (!e || *e || (errno == ERANGE) || (l >> 16))
cf_error("Number out of range"); cf_error("Number out of range");
cf_lval.i64 |= l; cf_lval.i64 |= l;
@ -266,7 +266,7 @@ WHITE [ \t]
unsigned long int l; unsigned long int l;
errno = 0; errno = 0;
l = bstrtoul16(yytext+2, &e); l = bstrtoul16(yytext+2, &e);
if (e && *e || errno == ERANGE || (unsigned long int)(unsigned int) l != l) if (!e || *e || errno == ERANGE || (unsigned long int)(unsigned int) l != l)
cf_error("Number out of range"); cf_error("Number out of range");
cf_lval.i = l; cf_lval.i = l;
return NUM; return NUM;
@ -277,7 +277,7 @@ WHITE [ \t]
unsigned long int l; unsigned long int l;
errno = 0; errno = 0;
l = bstrtoul10(yytext, &e); l = bstrtoul10(yytext, &e);
if (e && *e || errno == ERANGE || (unsigned long int)(unsigned int) l != l) if (!e || *e || errno == ERANGE || (unsigned long int)(unsigned int) l != l)
cf_error("Number out of range"); cf_error("Number out of range");
cf_lval.i = l; cf_lval.i = l;
return NUM; return NUM;