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

NodeJS 6.4.0 Empty String Range Error #18

Closed
Buffele opened this issue Aug 16, 2016 · 3 comments
Closed

NodeJS 6.4.0 Empty String Range Error #18

Buffele opened this issue Aug 16, 2016 · 3 comments

Comments

@Buffele
Copy link
Contributor

Buffele commented Aug 16, 2016

Hello,

Only affects latest NodeJS (6.4.0) Version. 6.3.1 worked fine.

var sp = require('../schemapack')

var stringSchema = sp.build('string')

var data = stringSchema.encode('')
var decoded = stringSchema.decode(data)

console.log(decoded)

Output:

        return this.utf8Write(string, offset, length);
                    ^

RangeError: Offset is out of bounds
    at RangeError (native)
    at Buffer.write (buffer.js:761:21)
    at Object.writeString (D:\Projects\schemapack\schemapack.js:67:29)
    at eval (eval at getCompiledSchema (D:\Projects\schemapack\schemapack.js:374:24), <anonymous>:3:209)
    at Object.encode (D:\Projects\schemapack\schemapack.js:389:14)
    at Object.<anonymous> (D:\Projects\schempack_test\test.js:5:25)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)```
@phretaddin
Copy link
Owner

phretaddin commented Aug 16, 2016

Hello! Looks like there was a change in the utf8Write implementation in Node between versions 6.3.1 and 6.4. I'll make an issue on their Github to see if it's intentional. If so, I'll just patch schemapack to check for strings of length 0 before writing.

@phretaddin
Copy link
Owner

The Node.js team confirmed this as a bug. Looks like it will be fixed in their next release. Just use 6.3.1 in the meantime, I suppose.

@noahwalugembe
Copy link

Can some one send me a client side implementation of schemapack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants