File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -4295,21 +4295,26 @@ LookupTable oplookup[] = {
42954295};
42964296
42974297static x86newTokenType getToken (const char * str , size_t * begin , size_t * end ) {
4298+ if (* begin > strlen (str )) {
4299+ return TT_EOF ;
4300+ }
42984301 // Skip whitespace
4299- while (begin && isspace ((ut8 )str [* begin ])) {
4302+ while (begin && str [ * begin ] && isspace ((ut8 )str [* begin ])) {
43004303 ++ (* begin );
43014304 }
43024305
43034306 if (!str [* begin ]) { // null byte
43044307 * end = * begin ;
43054308 return TT_EOF ;
4306- } else if (isalpha ((ut8 )str [* begin ])) { // word token
4309+ }
4310+ if (isalpha ((ut8 )str [* begin ])) { // word token
43074311 * end = * begin ;
4308- while (end && isalnum ((ut8 )str [* end ])) {
4312+ while (end && str [ * end ] && isalnum ((ut8 )str [* end ])) {
43094313 ++ (* end );
43104314 }
43114315 return TT_WORD ;
4312- } else if (isdigit ((ut8 )str [* begin ])) { // number token
4316+ }
4317+ if (isdigit ((ut8 )str [* begin ])) { // number token
43134318 * end = * begin ;
43144319 while (end && isalnum ((ut8 )str [* end ])) { // accept alphanumeric characters, because hex.
43154320 ++ (* end );
You can’t perform that action at this time.
0 commit comments