1. May 04, 2016
  2. May 03, 2016
  3. May 02, 2016
  4. May 01, 2016
  5. Apr 30, 2016
  6. Apr 29, 2016
    • Anna Henningsen's avatar
      src: unify implementations of Utf8Value etc. · 44a40325
      Anna Henningsen authored
      Unify the common code of `Utf8Value`, `TwoByteValue`, `BufferValue`
      and `StringBytes::InlineDecoder` into one class. Always make the
      result zero-terminated for the first three.
      
      This fixes two problems in passing:
      
      * When the conversion of the input value to String fails,
        make the buffer zero-terminated anyway. Previously, this would
        have resulted in possibly reading uninitialized data in multiple
        places in the code. An instance of that problem can be reproduced
        by running e.g.
        `valgrind node -e 'net.isIP({ toString() { throw Error() } })'`.
      * Previously, `BufferValue` copied one byte too much from the source,
        possibly resulting in an out-of-bounds memory access.
        This can be reproduced by running e.g.
        `valgrind node -e \
          'fs.openSync(Buffer.from("node".repeat(8192)), "r")'`.
      
      Further minor changes:
      * This lifts the `out()` method of `StringBytes::InlineDecoder`
        to the common class so that it can be used when using the
        overloaded `operato...
      44a40325