René's URL Explorer Experiment


Title: diff panics (`into_string().unwrap()`) on a non-UTF-8 argument ending in `--width=N` · Issue #247 · uutils/diffutils · GitHub

Open Graph Title: diff panics (`into_string().unwrap()`) on a non-UTF-8 argument ending in `--width=N` · Issue #247 · uutils/diffutils

X Title: diff panics (`into_string().unwrap()`) on a non-UTF-8 argument ending in `--width=N` · Issue #247 · uutils/diffutils

Description: Steps to reproduce $ printf 'a\nb\nc\n' > A; printf 'a\nX\nc\n' > B $ diffutils diff $'\xff--width=5' A B thread 'main' panicked at src/params.rs:116:45: called `Result::unwrap()` on an `Err` value: "\xFF--width=5" $ echo $? 134 diff abo...

Open Graph Description: Steps to reproduce $ printf 'a\nb\nc\n' > A; printf 'a\nX\nc\n' > B $ diffutils diff $'\xff--width=5' A B thread 'main' panicked at src/params.rs:116:45: called `Result::unwrap()` on an `Err` value...

X Description: Steps to reproduce $ printf 'a\nb\nc\n' > A; printf 'a\nX\nc\n' > B $ diffutils diff $'\xff--width=5' A B thread 'main' panicked at src/params.rs:116:45: calle...

Opengraph URL: https://github.com/uutils/diffutils/issues/247

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"diff panics (`into_string().unwrap()`) on a non-UTF-8 argument ending in `--width=N`","articleBody":"## Steps to reproduce\n\n```console\n$ printf 'a\\nb\\nc\\n' \u003e A; printf 'a\\nX\\nc\\n' \u003e B\n$ diffutils diff $'\\xff--width=5' A B\nthread 'main' panicked at src/params.rs:116:45:\ncalled `Result::unwrap()` on an `Err` value: \"\\xFF--width=5\"\n$ echo $?\n134\n```\n\n`diff` aborts (panic, exit 134) when given a non-UTF-8 argument whose lossy form ends in `--width=\u003cdigits\u003e` — e.g. an argument with a leading invalid byte like `$'\\xff--width=5'`.\n\n## Expected behavior\n\nMatch GNU: the unrecognized argument is a file operand; with three operands diff reports the extra operand and exits 2.\n\n```console\n$ /usr/bin/diff $'\\xff--width=5' A B\ndiff: extra operand 'B'\n$ echo $?\n2\n```\n\n## Root cause\n\nThe `--width` regex lacks a start anchor, unlike the sibling `--tabsize` one:\n\n```rust\n// src/params.rs:62-63\nlet tabsize_re = Regex::new(r\"^--tabsize=(?\u003cnum\u003e\\d+)$\").unwrap();   // anchored — safe\nlet width_re   = Regex::new(r\"--width=(?P\u003clong\u003e\\d+)$\").unwrap();    // no leading ^\n\n// src/params.rs:115-116\nif width_re.is_match(param.to_string_lossy().as_ref()) {   // matches lossy form\n    let param = param.into_string().unwrap();              // line 116: Err on non-UTF-8\n```\n\n`to_string_lossy()` maps invalid bytes to `U+FFFD`, so a non-UTF-8 argument whose tail is `--width=N` still matches; `into_string()` then fails on the real bytes.\nFix: anchor the regex at the start (`^--width=…$`, matching `tabsize_re`), and/or match on the bytes / avoid `into_string().unwrap()` so a non-UTF-8 argument falls through to the operand path. (The unanchored regex also makes `diff xyz--width=5` silently accept a width option instead of treating it as a filename — same root cause, non-panic symptom.)\n\n_Found by our static analysis tooling._","author":{"url":"https://github.com/leeewee","@type":"Person","name":"leeewee"},"datePublished":"2026-06-16T08:39:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/247/diffutils/issues/247"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5815e52e-0a0a-cdf5-c444-223c74c509ca
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA7A8:3E0D60:3485013:4814BAA:6A4F25C0
html-safe-nonce5ce63792c7c7fc9d7bf078e11ba08589066102199f07756c7e1acedee14a0513
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0E4OjNFMEQ2MDozNDg1MDEzOjQ4MTRCQUE6NkE0RjI1QzAiLCJ2aXNpdG9yX2lkIjoiMzUzMDEyMDkzMDQ2MTE2NDk5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacce6c447959ffbc80583601d4569ed2d4baa5ebcd180f1f05509c7b15453469b4
hovercard-subject-tagissue:4672525756
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/uutils/diffutils/247/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f92bdcadc39f3b77196528c4aada698feaf477f202b0b38ee271007ac60afd81/uutils/diffutils/issues/247
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f92bdcadc39f3b77196528c4aada698feaf477f202b0b38ee271007ac60afd81/uutils/diffutils/issues/247
og:image:altSteps to reproduce $ printf 'a\nb\nc\n' > A; printf 'a\nX\nc\n' > B $ diffutils diff $'\xff--width=5' A B thread 'main' panicked at src/params.rs:116:45: called `Result::unwrap()` on an `Err` value...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameleeewee
hostnamegithub.com
expected-hostnamegithub.com
Noneb92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9
turbo-cache-controlno-preview
go-importgithub.com/uutils/diffutils git https://github.com/uutils/diffutils.git
octolytics-dimension-user_id5148717
octolytics-dimension-user_loginuutils
octolytics-dimension-repository_id341787720
octolytics-dimension-repository_nwouutils/diffutils
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id341787720
octolytics-dimension-repository_network_root_nwouutils/diffutils
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2b8f23afb982271f1b22258a94aede67a6b77760
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/uutils/diffutils/issues/247#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fuutils%2Fdiffutils%2Fissues%2F247
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fuutils%2Fdiffutils%2Fissues%2F247
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=uutils%2Fdiffutils
Reloadhttps://github.com/uutils/diffutils/issues/247
Reloadhttps://github.com/uutils/diffutils/issues/247
Reloadhttps://github.com/uutils/diffutils/issues/247
Please reload this pagehttps://github.com/uutils/diffutils/issues/247
uutils https://github.com/uutils
diffutilshttps://github.com/uutils/diffutils
Notifications https://github.com/login?return_to=%2Fuutils%2Fdiffutils
Fork 35 https://github.com/login?return_to=%2Fuutils%2Fdiffutils
Star 270 https://github.com/login?return_to=%2Fuutils%2Fdiffutils
Code https://github.com/uutils/diffutils
Issues 20 https://github.com/uutils/diffutils/issues
Pull requests 12 https://github.com/uutils/diffutils/pulls
Actions https://github.com/uutils/diffutils/actions
Projects https://github.com/uutils/diffutils/projects
Security and quality 0 https://github.com/uutils/diffutils/security
Insights https://github.com/uutils/diffutils/pulse
Code https://github.com/uutils/diffutils
Issues https://github.com/uutils/diffutils/issues
Pull requests https://github.com/uutils/diffutils/pulls
Actions https://github.com/uutils/diffutils/actions
Projects https://github.com/uutils/diffutils/projects
Security and quality https://github.com/uutils/diffutils/security
Insights https://github.com/uutils/diffutils/pulse
#250https://github.com/uutils/diffutils/pull/250
diff panics (into_string().unwrap()) on a non-UTF-8 argument ending in --width=Nhttps://github.com/uutils/diffutils/issues/247#top
#250https://github.com/uutils/diffutils/pull/250
https://github.com/leeewee
leeeweehttps://github.com/leeewee
on Jun 16, 2026https://github.com/uutils/diffutils/issues/247#issue-4672525756
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.