Bug 82869

Summary: SIGSEGV in vsnprintf() in vi_VN.tcvn locale
Product: [Retired] Red Hat Linux Reporter: Martin Sebor <sebor>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Brian Brock <bbrock>
Severity: high Docs Contact:
Priority: medium    
Version: 8.0CC: fweimer, mitr
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-02-03 11:48:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Sebor 2003-01-27 23:04:21 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1)
Gecko/20020823 Netscape/7.0

Description of problem:
The program below fails with a SIGSEGV.

$ cat t.cpp; uname -a; gcc --version; gcc t.cpp && ./a.out
#include <stdio.h>
#include <stdarg.h>
#include <locale.h>

int foo (char *buf, const char *s, ...)
{
    va_list va;
    va_start (va, s);
    int n = vsprintf (buf, s, va);
    va_end (va);
    return n;
}

int main ()
{
    printf ("glibc %d.%d\n", __GLIBC__, __GLIBC_MINOR__);

    setlocale (LC_ALL, "vi_VN.tcvn");

    const char *a = "";
    const char *b = "Th";

    char buf [256];
    foo (buf, "%s%.*s", a, 2, b);
}

Linux stalwart.cvo.roguewave.com 2.4.18-14smp #1 SMP Wed Sep 4 12:34:47 EDT 2002
i686 i686 i386 GNU/Linux
gcc (GCC) 3.2
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

glibc 2.3
Segmentation fault


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. compile and run the program

    

Additional info:

Comment 1 Jakub Jelinek 2003-02-03 11:48:21 UTC
Should be fixed in glibc-2.3.1-40 and above.