Re: [dev] Re: st: Use after free

2017-01-24 Thread tty0
January 23, 2017 11:45 AM, "hiro" <23h...@gmail.com> wrote:
> nobody ever has time for me, *cry*

aww ♥




Re: [dev] Re: st: Use after free

2017-01-23 Thread hiro
nobody ever has time for me, *cry*



Re: [dev] Re: st: Use after free

2017-01-23 Thread Martin Kühne
On Mon, Jan 23, 2017 at 5:48 PM, Greg Reagle  wrote:
> Personally I think it is despicable and anti-progress to discourage bug
> reports.

I specifically asked to make sure it's a bug in st, which I didn't
write. And I no longer have all day to solve any problem that crosses
my path for anyone. Vague hints, even if they would turn out to reveal
an actual issue are counter productive because they mean potentially
many tiring debugging sessions for helpers. And, so I would like to
overstate, help send a project's contributors on ghost hunts,
effectively barring them from doing actual work. Let me not waste more
of your free time, though. https://xkcd.com/583/

cheers!
mar77i



Re: [dev] Re: st: Use after free

2017-01-23 Thread Greg Reagle
On Mon, Jan 23, 2017, at 10:18, Alexander Keller wrote:
> Now now. No need to hold contempt on the mailing lists. Suckless isn't
> some Linux list where we go off on people who want to help but didn't
> read the entire codebase, wiki, and archive before posting.

Uh, yea it is.  Where have you been?  Many times I have seen on this
list a poster who reports a bug without a patch scolded, berated, and
generally treated like shit for daring to do so.  I would think that a
suckless developer who takes pride in his/her programming would *want*
to know about any bugs regardless of whether a patch is provided, but it
seems like some people on this list take pride in their nastiness. 
Personally I think it is despicable and anti-progress to discourage bug
reports.

By the way, I'd like to point out that I've noticed that Laslo/FRIGN (if
you are the same person) has become much less grouchy and much more nice
in the recent past.  Thank you Laslo/FRIGN!



Re: [dev] Re: st: Use after free

2017-01-23 Thread Martin Kühne
On Mon, Jan 23, 2017 at 4:18 PM, Alexander Keller  wrote:
> Now now. No need to hold contempt on the mailing lists. Suckless isn't
> some Linux list where we go off on people who want to help but didn't
> read the entire codebase, wiki, and archive before posting.

Cool. I'll have to remember this one. "now now, do not hold contempt,
we're not one of those places" is a downright mindfuck.

cheers!
mar77i



[dev] Re: st: Use after free

2017-01-23 Thread Alexander Keller
On Mon, Jan 23, 2017, at 02:48, Martin Kühne wrote:
> I had a dream last night...

Now now. No need to hold contempt on the mailing lists. Suckless isn't
some Linux list where we go off on people who want to help but didn't
read the entire codebase, wiki, and archive before posting.

However, moosotc, it's always best to have even a basic working patch
when reporting problems to OSS projects. Doubly so on ones that focus on
code first, users second. :) Thank you for the patch.



[dev] Re: st: Use after free

2017-01-23 Thread moosotc
moos...@gmail.com writes:

> `valgrind st -f mono-2 cat full-bmp.txt' [1]
>
> Yields quite a few invalid reads from freed blocks, the issue is related
> to cache management. In the real world those dangling pointer issues
> lead to segfaults or X11 errors (eventually)
>
> [1] http://www.cl.cam.ac.uk/~mgk25/ucs/full-bmp.txt

Following avoids using freed fonts.

diff --git a/st.c b/st.c
index fbcd9e0..667e7af 100644
--- a/st.c
+++ b/st.c
@@ -3783,6 +3783,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph 
*glyphs, int len, int x
 */
if (frclen >= LEN(frc)) {
frclen = LEN(frc) - 1;
+   specs->font = NULL;
XftFontClose(xw.dpy, frc[frclen].font);
frc[frclen].unicodep = 0;
}
@@ -3928,7 +3929,10 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph 
base, int len, int x, i
XftDrawSetClipRectangles(xw.draw, winx, winy, , 1);
 
/* Render the glyphs. */
-   XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
+   if (specs->font)
+   XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
+   else
+   fprintf(stderr, "st: nil font\n");
 
/* Render underline and strikethrough. */
if (base.mode & ATTR_UNDERLINE) {

-- 
mailto:moos...@gmail.com



Re: [dev] Re: st: Use after free

2017-01-23 Thread moosotc
Martin Kühne  writes:

> On Mon, Jan 23, 2017 at 5:11 AM,   wrote:
>> What I believe[...]
>
> Whose responsibility would it be to test what you believe? It looks a
> lot like you expect us to figure out whether you are on to something
> relevant. I had a dream last night and in that dream I saw the
> glorious future of a moosotc figuring things out on his own. The
> issues, progress and the personal role that derives from what we
> accomplish this way is what gets us to places in life.
>

I don't think it's anyones responsibility, just that people who write
stuff want to know when there are problems with what they wrote.

-- 
mailto:moos...@gmail.com



Re: [dev] Re: st: Use after free

2017-01-22 Thread Martin Kühne
On Mon, Jan 23, 2017 at 5:11 AM,   wrote:
> What I believe[...]

Whose responsibility would it be to test what you believe? It looks a
lot like you expect us to figure out whether you are on to something
relevant. I had a dream last night and in that dream I saw the
glorious future of a moosotc figuring things out on his own. The
issues, progress and the personal role that derives from what we
accomplish this way is what gets us to places in life.

cheers!
mar77i



[dev] Re: st: Use after free

2017-01-22 Thread moosotc
moos...@gmail.com writes:

> `valgrind st -f mono-2 cat full-bmp.txt' [1]
>
> Yields quite a few invalid reads from freed blocks, the issue is related
> to cache management. In the real world those dangling pointer issues
> lead to segfaults or X11 errors (eventually)
>
> [1] http://www.cl.cam.ac.uk/~mgk25/ucs/full-bmp.txt

What I believe happens is this:

in xmakeglyphfontspecs
if (frclen >= LEN(frc)) {
frclen = LEN(frc) - 1;
XftFontClose(xw.dpy, frc[frclen].font);
frc[frclen].unicodep = 0;
}

but the font can be current in dc, and somehow xdrawglyphfontspecs uses
freshly freed font.

-- 
mailto:moos...@gmail.com