GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — diff: `-y --tabsize=<huge>` overflows the column arithmetic (overflow-checks only) · Issue #264 · uutils/diffutils

diff: -y --tabsize=<huge> overflows the column arithmetic (overflow-checks only) #264

New issue
Copy link
New issue
Copy link
Open
#270
Open
diff: -y --tabsize=<huge> overflows the column arithmetic (overflow-checks only)#264
#270
Copy link

Description

@leeewee
leeewee
opened on Jul 17, 2026
Issue body actions

SideDiffConfig::new (src/side_diff.rs) computes the side-by-side column layout with signed arithmetic on the --tabsize value:

let w = full_width as isize;
let t = tab_size as isize;
let t_plus_g = t + GUTTER_WIDTH_MIN as isize;      // <-- side_diff.rs:85: overflows
let unaligned_off = (w >> 1) + (t_plus_g >> 1) + (w & t_plus_g & 1);
let off = unaligned_off - unaligned_off % t;       // (also % by t, and t can be 0)

--tabsize is parsed into tab_size: usize with no upper bound. A value near isize::MAX makes t + GUTTER_WIDTH_MIN (GUTTER_WIDTH_MIN == 3) overflow isize. Under -C overflow-checks=on this aborts (exit 134); in the default release build it wraps to a bogus value and the layout math silently produces garbage widths.

$ printf 'a\n' > f1; printf 'b\n' > f2
$ diff -y --tabsize=9223372036854775805 f1 f2      # overflow-checks build
thread 'main' panicked at src/side_diff.rs:85:24:
attempt to add with overflow
$ echo $?
134

Activity

  1. sami-daniel
    added a commit that references this issue on Nov 6, 2026

    fix(side-diff): compute the column layout without signed casts

    This issue will close once commit 94a4d38 is merged into the 'main' branch.
    94a4d38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.