Package: flexml
Version: 1.9.2-1
Severity: normal
Tags: patch

Dear Maintainer,

Flexml generated code fails, when compiled with clang with optimizations
turned on.  The failure is at the instruction "assert(s <= e)" in
function bufferliteral().

In fact, when c == '\0', s in initialized to text-1, which does not
belong to text.  According to the C standard, comparing s and e in this
case leads to undefined behavior.

I suggest the following rewrite for the function bufferliteral() (line
135 of file "skel"):
----------------------------------------------------------------------
static void bufferliteral(char c, int* pp, const char* text)
{
    BUFFERSET(*pp);
    if (c) {
        const char *s = strchr(text, c), *e = strrchr(text, c);
        assert(s && e && s <= e);
        ++s;
        while (s < e) {
            if (isspace(*s)) {
                BUFFERPUTC(' ');
                do ++s; while (s < e && isspace(*s));
            } else
                BUFFERPUTC(*s++);
        }
    } else {
        const char *s = text;
        while (*s)
            BUFFERPUTC(*s++);
    }
    BUFFERDONE;
}
----------------------------------------------------------------------

Regards,

Arnaud


-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (50, 'unstable'), (40, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages flexml depends on:
ii  libc6              2.13-32
ii  libdate-calc-perl  6.3-1
ii  liburi-perl        1.60-1
ii  libwww-perl        6.04-1

Versions of packages flexml recommends:
ii  flex  2.5.35-10

flexml suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to