Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Sep 2021 14:21:04 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 258559] tcsh can crash in morecore() due to 32-bit arithmetic
Message-ID:  <bug-258559-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258559

            Bug ID: 258559
           Summary: tcsh can crash in morecore() due to 32-bit arithmetic
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: rtm@lcs.mit.edu

tcsh's allocator uses 32-bit ints in pointer arithmetic
in a way that's buggy on 64-bit machines: in morecore()
in tc.alloc.c, if bucket is >=3D 28, then these lines
aren't right:

    memtop =3D sbrk(1 << rnu);
    ...
    memtop +=3D (long) (1 << rnu);
    ...
    siz =3D 1 << (bucket + 3);

The shifts yield 32-bit signed values, but the amounts of
shift can be big enough that the results wrap.

Here's a way to see the crash (it takes a few tens of seconds):

  % echo '$x:s<' | tcsh -f

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-258559-227>