Giter Club home page Giter Club logo

js-binarypack's People

Contributors

afrokick avatar chancancode avatar divec avatar ericz avatar ghostoy avatar jcrugzz avatar jonasgloning avatar lmb avatar mend-bolt-for-github[bot] avatar michelle avatar michelle-stripe avatar orcaman avatar renovate[bot] avatar semantic-release-bot avatar snowycoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-binarypack's Issues

Peerjs crashes if you send any Unicode characters above U+FFFF

Steps to reproduce: Essentially, just conn.send( '𨋢' ) using the default binary serialization. See full example below.

Expected behaviour: Data is sent and received correctly.

Actual behaviour: The receiving peer crashes inside util.unpack, because the sender sent garbled data.

Cause
This happens when sending any Unicode codepoint above U+FFFF:

  • In the Javascript string, a single codepoint above U+FFFF is expressed as a UTF-16 surrogate pair made of two code units, e.g. '\uD860\uDEE2'.
  • This is a single Unicode codepoint (even though it has Javascript string length 2).
  • The function utf8Length wrongly assumes each individual surrogate becomes three UTF-8 bytes (i.e. a total of six bytes for a surrogate pair).
  • But in fact a surrogate pair, taken as a whole, becomes four UTF-8 bytes.
  • This length mismatch causes the crash in util.unpack.

Fix: #10

Workaround: Using JSON serialization (instead of the default binary) avoids the crash (but has certain other disadvantages).

Full code to reproduce the error

var peer1 = new Peer();
peer1.on( 'open', function ( id ) {
        var peer2 = new Peer();
        peer2.on( 'open', function() {
                var conn2 = peer2.connect( id );
                // But using JSON serialization, instead of the default binary, avoids the crash
                //var conn2 = peer2.connect( id, { serialization: 'json' } );
                conn2.on( 'open', function () {
                        // Send U+282E2, the Cantonese word for 'elevator'
                        // (but it could be any of the 93,000 Unicode codepoints above U+FFFF)
                        conn2.send( '𨋢' );
                } );
        } );
} );
peer1.on( 'connection', function ( conn1 ) {
        conn1.on( 'data', function ( data ) {
                // This never runs: util.unpack crashes before we get this far
                console.log( 'received: ' + data );
        } );
} );

feature request: add Blob and File support in 2.*

In version 1.0.1, support for Blob and File types was available. However, it seems that support for Blob and File types has been removed in version 2.0.0 after the introduction of TypeScript. The error message states, Type 'function Blob() { [native code] }' not yet supported.

Now that PeerJS is using the 2.0.0 version of js-binarypack, I would like to request the addition of support for Blob and File types in version 2.*.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Pending Approval

These branches will be created by Renovate only once you click their checkbox below.

  • chore(deps): update dependency eslint to v9

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

bun
package.json
  • @biomejs/biome 1.5.3
  • @jest/globals ^29.7.0
  • @parcel/packager-ts ^2.8.3
  • @parcel/transformer-typescript-types ^2.8.3
  • @semantic-release/changelog ^6.0.2
  • @semantic-release/git ^10.0.1
  • @typescript-eslint/eslint-plugin ^6.0.0
  • eslint ^8.34.0
  • parcel ^2.8.3
  • semantic-release ^23.0.0
  • typescript ^5.0.0
  • node >= 14.0.0
github-actions
.github/workflows/bun.yml
  • actions/checkout v4
  • oven-sh/setup-bun v1
.github/workflows/prettier.yml
  • actions/checkout v4
  • biomejs/setup-biome v2
.github/workflows/release.yml
  • actions/checkout v4
  • oven-sh/setup-bun v1

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.