unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Jai Vetrivelan <jaivetrivelan@gmail.com>, 54252@debbugs.gnu.org
Subject: [bug#54252] [PATCH] gnu: lemonbar: Update to 1.4.
Date: Sat, 05 Mar 2022 16:32:11 +0100	[thread overview]
Message-ID: <937e6a6666aee69ebf9377dd38144c5ebb4cdbe6.camel@telenet.be> (raw)
In-Reply-To: <87h78c4knq.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

[Please keep 54252@debbugs.gnu.org in CC or To, such that other people
can respond as well, such that discussion is not lost even if the
original reviewers disappear, for transparancy reasons, etc.]

Jai Vetrivelan schreef op za 05-03-2022 om 18:32 [+0530]:
> Hello Maxime,
> 
> On 2022-03-05, 10:59 +0100, Maxime Devos <maximedevos@telenet.be> wrote:
> 
> > At least in the 'master' branch (and presumably also in v1.4), there
> > are a few bugs.  At line 789, the return value of 'malloc' is not
> > checked, potentially causing a null-pointer dereference (and hence, a
> > segfault) at line 790 (in lemonbar.c).
> 
> Do you mean something like this?
> 
> ┌────
> │ diff --git a/lemonbar.c b/lemonbar.c
> │ index 4da59ee..93fcb20 100644
> │ --- a/lemonbar.c
> │ +++ b/lemonbar.c
> │ @@ -785,8 +785,8 @@ font_load (const char *pattern)
> │ 
> │      // Copy over the width lut as it's part of font_info
> │      int lut_size = sizeof(xcb_charinfo_t) * xcb_query_font_char_infos_length(font_info);
> │ -    if (lut_size) {
> │ -        ret->width_lut = malloc(lut_size);
> │ +    ret->width_lut = malloc(lut_size);
> │ +    if (lut_size && ret->width_lut) {
> │          memcpy(ret->width_lut, xcb_query_font_char_infos(font_info), lut_size);
> │      }
> └────

That just ignores the allocation failure, even though possibly the code
will use ret->width_lut later, expecting it to be non-NULL (or maybe it
actually handles NULL, I don't know).  Probably the allocation failure
needs to be reported (printf + exit, or return NULL, or something
else).  The exact mechanism used in C for handling allocation failures
depends on the application.

> > Could this be fixed?
> 
> I am not familiar with the C programming language, so I might not be
> able to fix this.

Ideally, things would be fixed upstream (it's on GitHub so you could
try submitting a pull request).  For Guix though, I believe simply
reporting the potential issue upstream (at
<https://github.com/LemonBoy/bar/issues>) would be sufficient.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  parent reply	other threads:[~2022-03-05 15:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-05  6:05 [bug#54252] [PATCH] gnu: lemonbar: Update to 1.4 Jai Vetrivelan
2022-03-05  9:59 ` Maxime Devos
     [not found]   ` <87h78c4knq.fsf@gmail.com>
2022-03-05 15:32     ` Maxime Devos [this message]
2022-03-11 12:32   ` Maxime Devos
2022-03-05 10:01 ` Maxime Devos
2022-03-11  0:47 ` bug#54252: " Nicolas Goaziou
2022-03-11  7:28   ` [bug#54252] " Maxime Devos
2022-03-11  8:31     ` Nicolas Goaziou
2022-03-11 19:15       ` Maxim Cournoyer
2022-03-11 22:09         ` Nicolas Goaziou
2022-03-11 22:30           ` Maxime Devos
2022-03-11 23:14             ` Nicolas Goaziou
2022-03-11 23:26               ` Maxime Devos

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=937e6a6666aee69ebf9377dd38144c5ebb4cdbe6.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=54252@debbugs.gnu.org \
    --cc=jaivetrivelan@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).