8000 Fix crashing on an empty MeshGL with one runIndex element by gongpha · Pull Request #1261 · elalish/manifold · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix crashing on an empty MeshGL with one runIndex element #1261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025

Conversation

gongpha
Copy link
Contributor
@gongpha gongpha commented May 25, 2025

Fixes #1260

  • Added a condition to check if runIndex == 1 to prevent out-of-bounds access; otherwise, it failed and raised RunIndexWrongLength.
  • Added tests related to runIndex

Anyway, I just read the description of runIndex. It appears that its length can be equal to the size of runOriginalID or runOriginalID + 1. Therefore, an empty runOriginalID (length = 0) followed by a single element runIndex may actually be valid. Given this, I think it shouldn't drop the error RunIndexWrongLength and let the input pass. (like my workaround)

Any ideas ?

CC @elalish

Copy link
codecov bot commented May 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.20%. Comparing base (551e1a1) to head (5199506).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1261      +/-   ##
==========================================
+ Coverage   92.18%   92.20%   +0.01%     
==========================================
  Files          31       31              
  Lines        5896     5898       +2     
==========================================
+ Hits         5435     5438       +3     
+ Misses        461      460       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pca006132
Copy link
Collaborator

Thanks. Will have a look later today.

@gongpha
Copy link
Contributor Author
gongpha commented May 28, 2025

An empty MeshGL with one runIndex is now valid and no longer crashes. I'm not sure about test naming though.

@pca006132
Copy link
Collaborator

Seems fine to me. Btw, I'm thinking if we should do more input validation, i.e., to make sure the indices are correct and don't segfault when they are incorrect.

@gongpha
Copy link
Contributor Author
gongpha commented May 28, 2025

I agree. It may be better to make another PR instead of this one

If possible, I'll investigate more types of exotic input later to see if any of them cause crashes or segfaults.

@pca006132
Copy link
Collaborator

Sounds good, I will let @elalish decide for the tests. I don't have a strong opinion about this.

Copy link
Owner
@elalish elalish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks!

@elalish elalish merged commit 023bb59 into elalish:master May 29, 2025
27 checks passed
@gongpha gongpha deleted the one-runindex branch May 29, 2025 12:47
This was referenced May 29, 2025
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.

Crashes on initialize Manifold with empty MeshGL but one element of runIndex
3 participants
0