From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127811 invoked by alias); 26 Apr 2017 09:35:45 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 127788 invoked by uid 89); 26 Apr 2017 09:35:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy=Hx-languages-length:1492 X-HELO: mail-it0-f46.google.com Received: from mail-it0-f46.google.com (HELO mail-it0-f46.google.com) (209.85.214.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Apr 2017 09:35:42 +0000 Received: by mail-it0-f46.google.com with SMTP id f187so29881199ite.1 for ; Wed, 26 Apr 2017 02:35:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=FWoAt+LFy+MTpiOeTAfyEbzF/XsdI/a3eBZgnOTRPzg=; b=kdqzLTzSZLxBeTpYLpNzKSiEfYYiwB530caG+bKt9ZGs3Y4jcZQ1xlrOGQsr1j8lcB 7/8tOx+M/N5OY2PHPq9VqWR5oa18K3tlHvf+y5NaJmWmi/mvVi7zY4uCJHpL89vJbpRB gVTmPi1VMSb6u7S+nUExE0U1igdAkiQXqiPjg84EXq12hzrfHTJpJZBsYDJ/8aurdLzx 2+hq6Nzpfx95dafP3vV03g581WGXpq6K7k5Rq3uGaybGJWtwvQ7HRfjt32LjnSwhI/tj TFI36haTikcYQBnbQ8zujQEQq0AQn07g96JOI5hG5MVPqUPtLtbvPwvQVRTosDxtw7F6 wRCA== X-Gm-Message-State: AN3rC/6rNaQIYtlhz7xK2buzLT6OGpRMaSd0zMrjUw3ARe2NZ7y4EDqi odcOSKqlDA8hTevwLzuMlAnrwcA1qaL4 X-Received: by 10.36.70.80 with SMTP id j77mr9986395itb.20.1493199342431; Wed, 26 Apr 2017 02:35:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.178.76 with HTTP; Wed, 26 Apr 2017 02:35:41 -0700 (PDT) In-Reply-To: <20170426082427.GD12712@calimero.vinschen.de> References: <20170426082427.GD12712@calimero.vinschen.de> From: Giacomo Tesio Date: Wed, 26 Apr 2017 09:35:00 -0000 Message-ID: Subject: Re: Uninitialized structure in printing functions To: newlib@sourceware.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00319.txt.bz2 Hi Corinna, I was trying to fix a simple "hello, world" test: https://github.com/JehanneOS/jehanne/blob/c2982db8a2c57a3250c129c28bb395715521ec4e/qa/lib/newlib/hello.c. During debug one of the issue I've noticed was a fault related to uio in vfprintf.c:348: apparently uio->uio_resid was uninitialized and actually the patch I provided fixed the test. However with a different test I'm working on now, I've found that zeroing the structures is not enough. Somehow uio->uio_resid overflows there, but I wasn't able yet to identify why or where. Any suggestion is welcome. I supposed I've just hit an untested combination of configure options, but actually --enable-newlib-mb is the only configure option I'm using (except for prefix and target, obviously). Giacomo 2017-04-26 10:24 GMT+02:00 Corinna Vinschen : > On Apr 21 19:03, Giacomo Tesio wrote: >> Hi, during the port to Jehanne, I had issues with the uninitialized >> uio structure in several printing functions. >> >> The attached patch fixes them. > > I'm puzzled what problem you're solving. > > I inspected the code in question and the uio structure is always filled > with values for all three members before using it. Setting uio to 0 > in all these places looks gratuitous. > > Can you please explain what exactly you're observing and how setting > uio to all 0 solved this problem? > > > Corinna > > -- > Corinna Vinschen > Cygwin Maintainer > Red Hat