Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tinystdio: Handled invalid sequence of characters #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions newlib/libc/tinystdio/conv_flt.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,12 @@ conv_flt (FLT_STREAM *stream, FLT_CONTEXT *context, width_t width, void *addr, u
if (!isdigit (edig))
{
scanf_ungetc(edig, stream, context);
if (esign != EOF)
scanf_ungetc(esign, stream, context);
if (esign != EOF) {
esign = scanf_getc (stream, context);
if(!isdigit (esign))
return 0;
scanf_ungetc(edig, stream, context);
}
goto no_exp;
}

Expand Down
2 changes: 2 additions & 0 deletions newlib/libc/tinystdio/vfscanf.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ conv_int (FILE *stream, scanf_context_t *context, width_t width, void *addr, uin
base = 16;
if (!--width || IS_EOF(i = scanf_getc (stream, context)))
goto putval;
if(!isxdigit(i))
goto err;
#ifdef _NEED_IO_PERCENT_B
} else if (i == 'b' && base <= 2) {
base = 2;
Expand Down
Loading