Skip to content

string_decoder: RangeError introduced by 6.2.1 #7308

Closed
@gagern

Description

  • Version: 6.2.1
  • Platform: Linux 4.6.1-gentoo x86_64 AuthenticAMD GNU/Linux
  • Subsystem: string_decoder

The update from 6.2.0 to 6.2.1 broke tests (on Travis and elsewhere) for CindyJS:

_stream_readable.js:65
  // not happen before the first write call.

RangeError: out of range index
    at RangeError (native)
    at StringDecoder.fillLast (string_decoder.js:94:9)
    at StringDecoder.write (string_decoder.js:73:14)
    at readableAddChunk (_stream_readable.js:160:31)
    at ReadStream.Readable.push (_stream_readable.js:130:10)
    at onread (fs.js:1774:12)
    at FSReqWrap.wrapper [as oncomplete] (fs.js:675:17)

The fact that the quoted line is a comment is highly confusing. It makes it hard to get a sound idea as to what's actually going on here. So I bisected the problem to 79ad172 for PR #6777.

So far I haven't managed to come up with a small reproducing example for this. The issue is perfectly reproducible in CindyJS/CindyJS@c685ce4, though. Just run node make forbidden in the top-level directory of a git clone (not a mere tarball download):

nvm install v6.2.1
git clone https://github.com/CindyJS/CindyJS.git
cd CindyJS
git checkout c685ce4
node make forbidden

It will check groups of files against forbidden regular expressions. The high-level task specification is in make/build.js, with the actual command implementation in make/commands.js. If I only operate on files matching globs, I don't see this error message, so the code running git ls-files is probably involved somehow. But even when I extracted those parts into a smaller separate script, I couldn't reproduce the issue, so I'm not sure what other components play a role here.

Note that there will be an error message about an attempt to re-evaluate the fs module, which is due to the outdated version of graceful-fs used by unzip. That is unrelated; uncommenting the require("unzip") line makes it go away while still reproducing the issue. I'll probably switch to something like yauzl soon.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    string_decoderIssues and PRs related to the string_decoder subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions