"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: tog: 'q' exits instead of quitting view (FreeBSD)
To:
gameoftrees@openbsd.org
Date:
Sun, 15 Nov 2020 00:20:16 +0100

Download raw body.

Thread
Stefan Sperling:

> > I start tog log,
> > hit 't' to switch to tree view,
> > hit 'l' to switch to log view for a file,
> > hit enter for the latest diff,
> > hit 'q' and ...
> > 
> > ... on FreeBSD, tog exits.  No error.  It's as if I had hit 'Q'.
> 
> Can you find out which condition causes view_loop() to exit?

dead_view == main_view && new_view == NULL

It's a bug hidden by memory randomization, which FreeBSD does not
have, at least by default.

The sequence above is:
1. open first log view
   => this view is remembered in main_view
2. open tree view
3. open second log view, closes first log view and tree view
   => the memory of the first log view and the tree view is free()ed
4. open diff view
   => malloc() returns the memory previously occupied by the first
      log view
   => the new diff view now matches main_view

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de