Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 25, 2025

MaximumLength(inapplicable.phyData[["Vinther2008"]]) crashed with status -1073741819 (access violation). The Vinther2008 dataset has 10 character states (0-9), triggering two bugs.

Bugs Fixed

  • Raw overflow in MaximumLength.numeric(): as.raw(seq_len(nToken)) silently truncates values >255. With 10 states, nToken = 1023, causing incorrect bit operations.

    # Before: overflows when nToken > 255
    bitTokens <- as.raw(seq_len(nToken))
    nonIntersect <- outer(bitTokens, bitTokens, `&`) == 00
    
    # After: uses integer bitwise ops
    bitTokens <- seq_len(nToken)
    nonIntersect <- outer(bitTokens, bitTokens, bitwAnd) == 0L
  • Incorrect indexing in MinimumLength.numeric(): tokens[, tokens[!squish], ...] is wrong—!squish on a positive integer returns FALSE. Fixed to tokens[, !tokens[squish, ], ...].

Guards Added

  • Check length(counts) > 0 before processing
  • Error for >30 states (would overflow integer capacity)

Tests

  • Regression tests for >8 states and Vinther2008 dataset specifically

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cloud.r-project.org
    • Triggering command: /usr/lib/R/bin/exec/R /usr/lib/R/bin/exec/R --no-echo --no-restore -e ~n~options(repos~&#43;~=~&#43;~c(CRAN~&#43;~=~&#43;~&#39;REDACTED&#39;))~n~install.packages(c(&#39;TreeTools&#39;,~&#43;~&#39;ape&#39;,~&#43;~&#39;Rcpp&#39;,~&#43;~&#39;cli&#39;,~&#43;~&#39;cluster&#39;,~&#43;~&#39;fastmap&#39;,~&#43;~&#39;fastmatch&#39;,~&#43;~&#39;fs&#39;,~&#43;~&#39;future&#39;,~&#43;~&#39;promises&#39;,~&#43;~&#39;protoclust&#39;,~&#43;~&#39;Rdpack&#39;,~&#43;~&#39;shiny&#39;,~&#43;~&#39;shinyjs (dns block)
  • cran.r-project.org
    • Triggering command: /usr/lib/R/bin/exec/R /usr/lib/R/bin/exec/R --no-echo --no-restore -e install.packages(c(&#39;devtools&#39;,~&#43;~&#39;testthat&#39;),~&#43;~repos=&#39;REDACTED&#39;,~&#43;~dependencies=TRUE) (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Crash in MaximumLength()</issue_title>
<issue_description>MaximumLength(inapplicable.phyData[["Vinther2008"]]) Exited with status -1073741819.

Tasks:

  • Diagnose the cause of the crash
  • Fix the underlying bug
  • If necessary, place guards so that similar issues fail politely
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 25, 2025 08:17
Co-authored-by: ms609 <1695515+ms609@users.noreply.github.com>
Co-authored-by: ms609 <1695515+ms609@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix crash issue in MaximumLength function Fix MaximumLength crash with datasets having >8 character states Nov 25, 2025
Copilot AI requested a review from ms609 November 25, 2025 08:21
@ms609 ms609 marked this pull request as ready for review November 25, 2025 10:36
@ms609 ms609 merged commit 81bd546 into main Nov 25, 2025
13 checks passed
@ms609 ms609 deleted the copilot/fix-maximumlength-crash branch November 25, 2025 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash in MaximumLength()

2 participants