This is the mail archive of the
ecos-maintainers@sourceware.org
mailing list for the eCos project.
Bugs in vfscanf.cxx(eCos)
- From: éäå <414256we at gmail dot com>
- To: ecos-maintainers <ecos-maintainers at ecos dot sourceware dot org>
- Date: Fri, 20 Nov 2015 10:41:22 +0800
- Subject: Bugs in vfscanf.cxx(eCos)
- Authentication-results: sourceware.org; auth=none
Problem:
vfscanf have problem to deal with string in utf-8 format.
Analyze:
In function:
externC int
vfscanf (FILE *fp, const char *fmt0, va_list ap) __THROW {
u_char *fmt = (u_char *) fmt0;
It declared that:
char ccltab[256];
char curr_byte;
When a byte's highest bit(the sign bit) is set, doing the
following conversion:
(int)*CURR_POS
it surely will generates an integer that is larger than 256(
Recall, signed bit extension).
While try to combine it with:
ccltab[(int)*CURR_POS])
a fairly bug yields.