deno icon indicating copy to clipboard operation
deno copied to clipboard

[Bug 1.25.1] (Deno.serve) panics after responding to curl request with an emoji in the "--data-urlencode" flag

Open sagea opened this issue 2 years ago • 1 comments

Description

Deno panics when making a curl request with an amoji in the --data-urlencode. The request makes it to the server and the response makes it to the client. (Look at the gif screenshot below.)

Works fine: curl "http://127.0.0.1:9999/normal" Server Blows Up: curl "http://127.0.0.1:9999/emoji" --data-urlencode "a=🌴"

Output (From the example below)

Server Started... http://127.0.0.1:9999/
⏰ Recieved: http://127.0.0.1:9999/normal
✅ Completed: http://127.0.0.1:9999/normal
⏰ Recieved: http://127.0.0.1:9999/emoji
✅ Completed: http://127.0.0.1:9999/emoji

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos x86_64
Version: 1.25.1
Args: ["deno", "run", "-A", "--unstable", "serve-test.ts"]

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', ext/flash/lib.rs:715:41
stack backtrace:
   0:        0x104dd1149 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h85521558a183f368
   1:        0x104378d8b - core::fmt::write::h01631fae0d2b98bc
   2:        0x104da1f68 - std::io::Write::write_fmt::h675dde99a2999169
   3:        0x104dd5f3d - std::panicking::default_hook::{{closure}}::h5e5df492d229fd65
   4:        0x104dd5c24 - std::panicking::default_hook::h18647b59f1a84ee2
   5:        0x1042eb26b - deno::setup_panic_hook::{{closure}}::h92c4da2c5f40e0fc
   6:        0x104dd6a8b - std::panicking::rust_panic_with_hook::hd9ead35a68ccc55e
   7:        0x104dd68df - std::panicking::begin_panic_handler::{{closure}}::h6fca91c5e1dc2f30
   8:        0x104dd6879 - std::sys_common::backtrace::__rust_end_short_backtrace::h4ff3025d9a0a0490
   9:        0x104dd6835 - _rust_begin_unwind
  10:        0x1061cf893 - core::panicking::panic_fmt::h3d9f795ee387ef8d
  11:        0x1061cf977 - core::panicking::panic::h02eb82771823ab30
  12:        0x10460073c - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h64dca9964049c833
  13:        0x1045fff37 - <extern "C" fn(A0) .> R as v8::support::CFnFrom<F>>::mapping::c_fn::h8450d94c0b90c5f8
  14:        0x10526180e - __ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEENS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EEPmi
  15:        0x105260ce6 - __ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE

Example

emoji-data-urlencode-example

Command RUST_BACKTRACE=full deno run -A --unstable serve-test.ts SourceCode

Deno.serve(
  (request) => {
    try {
      console.log(`⏰ Recieved: ${request.url}`);
      return new Response('Worked')
    } finally {
      console.log(`✅ Completed: ${request.url}`)
    }
  },
  {
    port: 9999,
    onListen({ hostname, port }) {
      console.log(`Server Started... http://${hostname}:${port}/`);
    }
  } 
)

sagea avatar Sep 04 '22 02:09 sagea

Turns out it has nothing to do with the emojii. It seems anytime you pass data it panics

brenelz avatar Sep 13 '22 02:09 brenelz

Fixed by https://github.com/denoland/deno/pull/16173

littledivy avatar Jan 15 '23 04:01 littledivy