widl: Increase max import depth.

Backport from Wine commit ba6b020b9f792539f4004ec93932231715e90051
Fixes segfault, e.g. while generating dxgi1_6.h
This commit is contained in:
Ozkan Sezer 2024-05-29 04:01:10 +03:00
parent be4c85af5f
commit f4fb3ad87e
2 changed files with 8 additions and 2 deletions

View File

@ -76,7 +76,7 @@ static int cbufalloc = 0;
static int kw_token(const char *kw);
static int attr_token(const char *kw);
#define MAX_IMPORT_DEPTH 10
#define MAX_IMPORT_DEPTH 20
struct {
YY_BUFFER_STATE state;
char *input_name;
@ -517,6 +517,9 @@ int do_import(char *fname)
else if (!(path = wpp_find_include( fname, input_name )))
error_loc("Unable to open include file %s\n", fname);
if (import_stack_ptr == MAX_IMPORT_DEPTH)
error_loc("Exceeded max import depth\n");
import_stack[ptr].temp_name = temp_name;
import_stack[ptr].input_name = input_name;
import_stack[ptr].line_number = line_number;

View File

@ -743,7 +743,7 @@ static int cbufalloc = 0;
static int kw_token(const char *kw);
static int attr_token(const char *kw);
#define MAX_IMPORT_DEPTH 10
#define MAX_IMPORT_DEPTH 20
struct {
YY_BUFFER_STATE state;
char *input_name;
@ -2628,6 +2628,9 @@ int do_import(char *fname)
else if (!(path = wpp_find_include( fname, input_name )))
error_loc("Unable to open include file %s\n", fname);
if (import_stack_ptr == MAX_IMPORT_DEPTH)
error_loc("Exceeded max import depth\n");
import_stack[ptr].temp_name = temp_name;
import_stack[ptr].input_name = input_name;
import_stack[ptr].line_number = line_number;