Skip to content

Commit

Permalink
Fix a signed character issue with fuzzer-generated "code" (Issue #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Jul 3, 2019
1 parent 19532db commit f030a57
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Changes in v3.2

- The default HTML stylesheet no longer puts an outline box around monospaced
text (Issue #2)
- Fixed a signed character issue with fuzzer-generated "code" (Issue #4)
- Fixed a buffer overflow issue with fuzzer-generated "code" (Issue #5)
- Now use the base name of the cover image filename in HTML output.
- Fixed some markdown parsing issues.
Expand Down
14 changes: 7 additions & 7 deletions codedoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2406,7 +2406,7 @@ scan_file(filebuf_t *file, /* I - File to scan */
DEBUG_puts("Identifier: <<<< / >>>\n");

ch = get_nth_text(type, -1, NULL)[0];
mxmlNewText(type, isalnum(ch) || ch == '_', "/");
mxmlNewText(type, isalnum(ch & 255) || ch == '_', "/");
}
}
break;
Expand Down Expand Up @@ -2847,7 +2847,7 @@ scan_file(filebuf_t *file, /* I - File to scan */
DEBUG_puts("Identifier: <<<< * >>>\n");

ch = get_nth_text(type, -1, NULL)[0];
mxmlNewText(type, isalnum(ch) || ch == '_', "*");
mxmlNewText(type, isalnum(ch & 255) || ch == '_', "*");
}
break;

Expand Down Expand Up @@ -2875,7 +2875,7 @@ scan_file(filebuf_t *file, /* I - File to scan */
DEBUG_puts("Identifier: <<<< + >>>\n");

ch = get_nth_text(type, -1, NULL)[0];
mxmlNewText(type, isalnum(ch) || ch == '_', "+");
mxmlNewText(type, isalnum(ch & 255) || ch == '_', "+");
}
break;

Expand All @@ -2885,7 +2885,7 @@ scan_file(filebuf_t *file, /* I - File to scan */
DEBUG_puts("Identifier: <<<< - >>>\n");

ch = get_nth_text(type, -1, NULL)[0];
mxmlNewText(type, isalnum(ch) || ch == '_', "-");
mxmlNewText(type, isalnum(ch & 255) || ch == '_', "-");
}
break;

Expand All @@ -2895,12 +2895,12 @@ scan_file(filebuf_t *file, /* I - File to scan */
DEBUG_puts("Identifier: <<<< = >>>\n");

ch = get_nth_text(type, -1, NULL)[0];
mxmlNewText(type, isalnum(ch) || ch == '_', "=");
mxmlNewText(type, isalnum(ch & 255) || ch == '_', "=");
}
break;

default : /* Other */
if (isalnum(ch) || ch == '_' || ch == '.' || ch == ':' || ch == '~')
if (isalnum(ch & 255) || ch == '_' || ch == '.' || ch == ':' || ch == '~')
{
state = STATE_IDENTIFIER;

Expand Down Expand Up @@ -3368,7 +3368,7 @@ scan_file(filebuf_t *file, /* I - File to scan */
break;

case STATE_IDENTIFIER : /* Inside a keyword or identifier */
if (isalnum(ch) || ch == '_' || ch == '[' || ch == ']' ||
if (isalnum(ch & 255) || ch == '_' || ch == '[' || ch == ']' ||
(ch == ',' && (parens > 1 || (type && !enumeration && !function))) ||
ch == ':' || ch == '.' || ch == '~')
{
Expand Down

0 comments on commit f030a57

Please sign in to comment.