From: Florian Weimer <fweimer@redhat.com>
To: Abhidnya Joshi <abhidnyachirmule@gmail.com>
Cc: libc-locales@sourceware.org
Subject: Re: Crash in gconv_db.c
Date: Thu, 12 Dec 2019 15:58:00 -0000 [thread overview]
Message-ID: <875ziledsy.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <CALmqtCU6KB6qu1c7R4ngZh=0v+jvqOVjUT431zJoVsKhiNQdbw@mail.gmail.com> (Abhidnya Joshi's message of "Fri, 29 Nov 2019 00:17:42 +0530")
* Abhidnya Joshi:
> In increment_counter function, do we have to handle integer overflow like this?
>
>
> if (step->__counter == INT_MAX)
> {
> step->__counter = 1
> }
> if (step->__counter++ == 0)
> { ....
> }
>
> I do not understand what will be impact of this on different "steps".
> If step->__counter gets set to 0 and step->__modname is NULL
> then we see the segfault as mentioned earlier.
The steps array has reference counts in the array *elements*, which is
wrong. We ran into this a couple of months ago when we tried to fix a
memory leak. This is the reason why I have limited confidence in the
correctness of the reference counting.
I looked at what it would take to reproduce the overflow with repeated
iconv_open calls, and I estimate that 1.2 TiB of RAM are required, so I
have not reproduced that yet.
But there could be more subtle ways to trigger counter overflow, like
uselocale followed by pthread_exit. Without a reproducer, we are in the
dark here unfortunately.
Thanks,
Florian
next prev parent reply other threads:[~2019-12-12 15:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 16:05 Abhidnya Joshi
2019-11-11 16:19 ` Florian Weimer
2019-11-11 16:47 ` Abhidnya Joshi
[not found] ` <CALmqtCVBCb2vJ+XNb6WZa1csNZaisLmqoG5nTn-QUU0MO=UbPw@mail.gmail.com>
2019-11-14 17:34 ` Florian Weimer
2019-11-19 14:05 ` Abhidnya Joshi
2019-11-28 18:47 ` Abhidnya Joshi
2019-12-12 15:58 ` Florian Weimer [this message]
2019-12-20 15:05 ` Abhidnya Joshi
2019-12-20 15:16 ` Florian Weimer
2019-12-20 15:40 ` Abhidnya Joshi
2019-12-20 15:43 ` Florian Weimer
2019-12-20 15:53 ` Abhidnya Joshi
2019-12-20 16:09 ` Florian Weimer
2019-12-20 16:42 ` Abhidnya Joshi
2019-12-20 16:47 ` Florian Weimer
2019-12-20 17:18 ` Abhidnya Joshi
2019-12-20 18:39 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875ziledsy.fsf@oldenburg2.str.redhat.com \
--to=fweimer@redhat.com \
--cc=abhidnyachirmule@gmail.com \
--cc=libc-locales@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).