Skip to content
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

Avoid panics for empty or multibyte image usemap #16063

Merged
merged 1 commit into from Apr 12, 2017

Conversation

@methyl
Copy link
Contributor

methyl commented Mar 21, 2017

Some check were added to make sure we can call split_at with no risk of panics (when value is empty or the first char is multibyte).


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #15883 (github issue number if applicable).
  • There are tests for these changes

This change is Reviewable

@highfive
Copy link

highfive commented Mar 21, 2017

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @metajack (or someone else) soon.

@methyl
Copy link
Contributor Author

methyl commented Mar 21, 2017

cc @Ms2ger

@methyl methyl force-pushed the methyl:image-usemap-panics branch from 7b34d87 to ee310fd Mar 21, 2017
@wafflespeanut
Copy link
Member

wafflespeanut commented Mar 25, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Mar 25, 2017

Trying commit ee310fd with merge 9015d61...

bors-servo added a commit that referenced this pull request Mar 25, 2017
Avoid panics for empty or multibyte image usemap

<!-- Please describe your changes on the following line: -->
Some check were added to make sure we can call `split_at` with no risk of panics (when value is empty or the first char is multibyte).

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #15883 (github issue number if applicable).
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16063)
<!-- Reviewable:end -->
@wafflespeanut
Copy link
Member

wafflespeanut commented Mar 25, 2017

Sorry, nobody checked this (I think @Ms2ger is on PTO).

@bors-servo
Copy link
Contributor

bors-servo commented Mar 25, 2017

@nox
Copy link
Member

nox commented Mar 25, 2017

Please instead do the same test changes as in #16128.

@nox nox assigned nox and unassigned metajack Mar 25, 2017
@methyl
Copy link
Contributor Author

methyl commented Mar 25, 2017

@nox 👍, but it's missing case of empty usemap, right?

@nox
Copy link
Member

nox commented Mar 25, 2017

Indeed! Do add a test case for that too in the file modified in that other PR.

@methyl
Copy link
Contributor Author

methyl commented Mar 25, 2017

Are such changes then upstreamed to w3c/wpt?

@nox
Copy link
Member

nox commented Mar 25, 2017

Yes.

@methyl
Copy link
Contributor Author

methyl commented Mar 25, 2017

@nox
Copy link
Member

nox commented Mar 25, 2017

@methyl I think this test fails for reasons unrelated to the panic you fixed.

@nox
Copy link
Member

nox commented Mar 25, 2017

Remove the expectation and run it to see why it actually fails.

@methyl
Copy link
Contributor Author

methyl commented Mar 25, 2017

I think I know what's going on. The WPT test is just rendering the element, while the panic happens only when you click on it, so itself it won't uncover this bug. My test was covering exactly this case, do you think we don't need it?

@jdm
Copy link
Member

jdm commented Apr 12, 2017

This looks good as written since the test is actually testing the changes we care about.
@bors-servo: r=nox

@bors-servo
Copy link
Contributor

bors-servo commented Apr 12, 2017

📌 Commit ee310fd has been approved by nox

@bors-servo
Copy link
Contributor

bors-servo commented Apr 12, 2017

Testing commit ee310fd with merge 69eda6a...

bors-servo added a commit that referenced this pull request Apr 12, 2017
Avoid panics for empty or multibyte image usemap

<!-- Please describe your changes on the following line: -->
Some check were added to make sure we can call `split_at` with no risk of panics (when value is empty or the first char is multibyte).

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #15883 (github issue number if applicable).
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16063)
<!-- Reviewable:end -->
@nox
Copy link
Member

nox commented Apr 12, 2017

@jdm Thanks, I missed that somehow.

@bors-servo
Copy link
Contributor

bors-servo commented Apr 12, 2017

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev
Approved by: nox
Pushing 69eda6a to master...

@bors-servo bors-servo merged commit ee310fd into servo:master Apr 12, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

7 participants
You can’t perform that action at this time.