Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cb3ea684
Commit
cb3ea684
authored
Oct 18, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Oct 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Check for overflow when parsing integer constants.
parent
f24678b2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
parser.l
tools/widl/parser.l
+16
-2
No files found.
tools/widl/parser.l
View file @
cb3ea684
...
...
@@ -47,6 +47,7 @@ double [0-9]+\.[0-9]+([eE][+-]?[0-9]+)*
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include <limits.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
...
...
@@ -82,6 +83,19 @@ struct {
} import_stack[MAX_IMPORT_DEPTH];
int import_stack_ptr = 0;
/* converts an integer in string form to an unsigned long and prints an error
* on overflow */
static unsigned long xstrtoul(const char *nptr, char **endptr, int base)
{
unsigned long l;
errno = 0;
l = strtoul(nptr, endptr, base);
if (l == ULONG_MAX && errno == ERANGE)
error_loc("integer constant %s is too large\n", nptr);
return l;
}
UUID *parse_uuid(const char *u)
{
UUID* uuid = xmalloc(sizeof(UUID));
...
...
@@ -154,11 +168,11 @@ UUID *parse_uuid(const char *u)
return aUUID;
}
<INITIAL,ATTR>{hex} {
parser_lval.num = strtoul(yytext, NULL, 0);
parser_lval.num =
x
strtoul(yytext, NULL, 0);
return aHEXNUM;
}
<INITIAL,ATTR>{int} {
parser_lval.num = strtoul(yytext, NULL, 0);
parser_lval.num =
x
strtoul(yytext, NULL, 0);
return aNUM;
}
<INITIAL>{double} {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment