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

Layout panic when clicking on link to binary file #7701

Closed
jdm opened this issue Sep 21, 2015 · 7 comments
Closed

Layout panic when clicking on link to binary file #7701

jdm opened this issue Sep 21, 2015 · 7 comments
Labels
A-layout/text I-panic Servo encounters a panic.

Comments

@jdm
Copy link
Member

jdm commented Sep 21, 2015

eg. firefox.com's download button

stack backtrace:
   1:        0x1037634a0 - sys::backtrace::tracing::imp::write::hd0176e40ebe71d28Vks
   2:        0x1037666a9 - panicking::on_panic::h929e7e75bc4f2c31NXw
   3:        0x103755842 - rt::unwind::begin_unwind_inner::h9d2d49cde66c0c4b0sw
   4:        0x103755eed - rt::unwind::begin_unwind_fmt::h30d162ea92169f156rw
   5:        0x103766107 - rust_begin_unwind
   6:        0x10378b250 - panicking::panic_fmt::ha85fd08dcab4df5d8PE
   7:        0x10378fa70 - str::slice_error_fail::h6c64708b936def9aQ7M
   8:        0x10138e805 - str::traits::str.ops..Index<ops..Range<usize>>::index::h5c712b080eb21315ATM
   9:        0x10138b55e - process_text::h7e728c3015bb297f9Ib
  10:        0x1010d0dad - text::TextRunScanner::scan_for_runs::h68021d2b1d61542efby
  11:        0x1010e2376 - construct::FlowConstructor<'a>::build_flow_for_block_starting_with_fragments::h46af83a2b639423fLKd
  12:        0x1010e5b89 - construct::FlowConstructor<'a>::build_flow_for_block_like::h4254f8a6920a6687mNd
  13:        0x1010e839a - construct::FlowConstructor<'a>::build_flow_for_block::h0515d03cde8d641b8Qd
  14:        0x1010e4944 - construct::FlowConstructor<'a>.PostorderNodeMutTraversal::process::h494f170c6c190dc1Ype
  15:        0x10132055d - traversal::ConstructFlows<'a>.PostorderDomTraversal::process::haa946c6f430b5b960Zy
  16:        0x10132014d - parallel::ParallelPostorderDomTraversal::run_parallel::h1117234973821920439
  17:        0x101320096 - parallel::construct_flows::h6cc091e0b66b0a71b3t
  18:        0x10131eef8 - parallel::RecalcStyleForNode<'a>.ParallelPreorderDomTraversal::run_parallel::h16c6b3f19f38805ae2t
  19:        0x10131ffe2 - parallel::recalc_style::h239c34ec7e22fc3dE2t
  20:        0x10121b3af - workqueue::WorkerThread<QueueData, WorkData>::start::h18037580520219270155
  21:        0x10121ab2f - workqueue::WorkQueue<QueueData, WorkData>::new::closure.53521
  22:        0x10121a9da - task::spawn_named::closure.53514
  23:        0x10121a919 - boxed::F.FnBox<A>::call_box::h15424255898831889789
  24:        0x1011d608b - boxed::Box<FnBox<A, Output $u3d$$u20$R$GT$$u2b$$u20$Send$u20$$u2b$$u20$$u27$a$GT$.FnOnce$LT$A$GT$::call_once::h4324773148212385334
  25:        0x1011d5c6d - thread::Builder::spawn_inner::closure.51699
  26:        0x1011d5c19 - rt::unwind::try::try_fn::h15351741628393356514
  27:        0x1037660b8 - __rust_try
  28:        0x103761dc0 - rt::unwind::try::inner_try::h03cd26bf8e2ee1ceTow
  29:        0x1011d5b83 - rt::unwind::try::h3133819360463872697
  30:        0x1011d59fb - thread::Builder::spawn_inner::closure.51676
  31:        0x1011d62ac - boxed::F.FnBox<A>::call_box::h6128871607861653644
  32:        0x10376546d - sys::thread::Thread::new::thread_start::he62641fb2961f41aBNv
  33:     0x7fff928ae898 - _pthread_body
  34:     0x7fff928ae729 - _pthread_start
@jdm
Copy link
Member Author

jdm commented Sep 21, 2015

thread 'LayoutWorker worker 5/6' panicked at 'index 19431 and/or 19445 in...binary content...do not lie on character boundary', src/libcore/str/mod.rs:1328

@jdm jdm added A-layout/text I-panic Servo encounters a panic. labels Sep 21, 2015
@SimonSapin
Copy link
Member

I think we should do two things here:

  • Not panic when random binary data is parsed as HTML and rendered through layout
  • Check the Content-Type header to not even try to render binary resources as HTML. (Eventually, offer a download instead.)

@jdm
Copy link
Member Author

jdm commented Sep 22, 2015

Filed #7706 for part 2.

@eefriedman
Copy link
Contributor

For the panic, I think the issue is here: https://github.com/servo/unicode-bidi/blob/b3813c271853333fe75b553796aec5fe94ecc807/src/lib.rs#L288 . I think i + 1 is supposed to be i + c.len_utf8()? Presumably the issue never came up because real text never uses U+0085 or U+2029.

@SimonSapin
Copy link
Member

CC @mbrubeck re unicode-bidi

@mbrubeck
Copy link
Contributor

@eefriedman Good catch. Would you like to file a PR on unicode-bidi to fix that, or shall I?

@eefriedman
Copy link
Contributor

servo/unicode-bidi#17

mbrubeck added a commit to mbrubeck/servo that referenced this issue Sep 25, 2015
bors-servo pushed a commit that referenced this issue Sep 25, 2015
Update unicode-bidi to 0.2.2

Fixes #7701 via servo/unicode-bidi#17.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7742)
<!-- Reviewable:end -->
mbrubeck added a commit to mbrubeck/servo that referenced this issue Sep 25, 2015
bors-servo pushed a commit that referenced this issue Sep 25, 2015
Update unicode-bidi to 0.2.2

Fixes #7701 via servo/unicode-bidi#17.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7742)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-layout/text I-panic Servo encounters a panic.
Projects
None yet
Development

No branches or pull requests

4 participants