Git Product home page Git Product logo

Comments (4)

kjvalencik avatar kjvalencik commented on August 23, 2024

When using a numbered tag higher than 15, PBF will throw errors. Tags starting at 16 should be used to encode less frequently used fields, as the tag takes up two bytes instead of one.

Are you able to provide a simple proto file that reproduces this bug? There's only one unit test for this case.

message Packed {
repeated int32 value = 16;
}

pbf/test/compile.test.js

Lines 74 to 90 in bc2da8f

test('compiles packed with multi-byte tags', function(t) {
var proto = resolve(path.join(__dirname, './fixtures/packed_proto3.proto'));
var Packed = compile(proto).Packed;
var original = {
value: [300, 400, 500]
};
var pbf = new Pbf();
Packed.write(original, pbf);
var buf = pbf.finish();
var decompressed = Packed.read(new Pbf(buf));
t.equals(buf.length, 9);
t.deepEqual(original, decompressed);
t.end();
});

I tried a few simple combinations and was unable to break it.

Update

When using more than 127 repeatable elements, PBF will throw errors like "Uncaught Error: Unimplemented type: 7" or it will parse the fields incorrectly, seemingly at random, even with the exact same input.

I was also unable to cause this issue. A protofile that reproduces would be appreciated. Thanks!

from pbf.

kjvalencik avatar kjvalencik commented on August 23, 2024

@Ziao Are you able to provide proto files that reproduce?

from pbf.

Ziao avatar Ziao commented on August 23, 2024

Sorry for the late reply. I'll upload an example proto file and schema asap.

from pbf.

mourner avatar mourner commented on August 23, 2024

Closing this issue because of a lack of reproducible test cases. Will happily reopen once those are provided and verified.

from pbf.

Related Issues (20)

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.