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

lib: add case of no argument to ERR_INVALID_ARG_VALUE in errors.js #21262

Closed
wants to merge 6 commits into from

Commits on Jun 11, 2018

  1. lib: add case of no argument to ERR_INVALID_ARG_VALUE in errors.js

    ERR_INVALID_ARG_VALUE is an error for wrong arguments given to the
    function. But calling a function without argument should also generate
    a sensible error message. For no argument case, parameter 'value'
    should be passed with zero value and the error message is generated.
    
    In readSync(fd, buffer, offset, length, position), triggers
    validateOffsetLengthRead() in lib/internal/fs/utils.js for validation.
    When buffer is empty, a weird message is generated "The value of offset
    is out of range.It must be >= 0 && <= 0. Received 0". There should be a
    special case when buffer is empty or bufferLength is zero, which should
    trigger ERR_INVALID_ARG_VALUE error.
    
    Fixes: nodejs#21193
    AdityaSrivast committed Jun 11, 2018
    Configuration menu
    Copy the full SHA
    f2f5c0c View commit details
    Browse the repository at this point in the history
  2. lib: add case of no argument to ERR_INVALID_ARG_VALUE in errors.js

    ERR_INVALID_ARG_VALUE is an error for wrong arguments given to the
    function. But calling a function without argument should also generate
    a sensible error message. For no argument case, parameter 'value'
    should be passed with zero value and the error message is generated.
    
    In readSync(fd, buffer, offset, length, position), triggers
    validateOffsetLengthRead() in lib/internal/fs/utils.js for validation.
    When buffer is empty, a weird message is generated "The value of offset
    is out of range.It must be >= 0 && <= 0. Received 0". There should be a
    special case when buffer is empty or bufferLength is zero, which should
    trigger ERR_INVALID_ARG_VALUE error.
    
    Fixes: nodejs#21193
    AdityaSrivast committed Jun 11, 2018
    Configuration menu
    Copy the full SHA
    e05f49c View commit details
    Browse the repository at this point in the history
  3. lib: add case of bufferLength to validateOffsetLengthRead() in utils.js

    In validateOffsetLengthRead(), an error message is generated if offset
    or length are out of range. There should also be an error message if
    buffer is empty, in which case it cannot write data in it.
    
    Generally this validateOffsetLengthRead() is triggered with
    fs.readSync(fd, buffer, offset, length, position), where if buffer is
    empty, the case for zero bufferLength is triggered and the
    corresponding message is thrown.
    
    Fixes: nodejs#21193
    AdityaSrivast committed Jun 11, 2018
    Configuration menu
    Copy the full SHA
    7af6bb3 View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2018

  1. lib: add case of bufferLength to validateOffsetLengthRead() in utils.js

    In validateOffsetLengthRead(), an error message is generated if offset
    or length are out of range. But there should also be an error message
    if buffer is empty, when no data can be written on it.
    
    Generally, validateOffsetLengthRead() is triggered with
    fs.readSync(fd, buffer, offset, length, position), where if 'buffer' is
    empty, the case for zero bufferLength should be triggered and the
    error message for empty buffer should be thrown.
    
    Fixes: nodejs#21193
    AdityaSrivast committed Jun 12, 2018
    Configuration menu
    Copy the full SHA
    7c1d365 View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2018

  1. lib: add empty buffer case to read and readSync function in fs

    While using read() or readSync() function, it should be verified that
    the arguments of the function are in proper range and hold legitimate
    values, for a successful read process.
    For this validateOffsetLengthRead() function is called, which gives an
    error message for offset and length passed by the user, if not in
    order. But there should also be an error when an empty buffer is passed
    as argument, when it cannot be written over.
    The empty buffer case should be checked before calling
    validateOffsetLengthRead() and ERR_INVALID_ARG_VALUE should be thrown
    corresponding to the empty buffer argument in read and readSync
    function.
    
    Fixes: nodejs#21193
    AdityaSrivast committed Jun 16, 2018
    Configuration menu
    Copy the full SHA
    8043755 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2018

  1. lib: add empty buffer case to read and readSync function in fs

    While using read() or readSync() function, it should be verified that
    the arguments of the function are in proper range and hold legitimate
    values, for a successful read process.
    For this validateOffsetLengthRead() function is called, which gives an
    error message for offset and length passed by the user, if not in
    order. But there should also be an error when an empty buffer is passed
    as argument, when it cannot be written over.
    The empty buffer case should be checked before calling
    validateOffsetLengthRead() and ERR_INVALID_ARG_VALUE should be thrown
    corresponding to the empty buffer argument in read and readSync
    function.
    
    Fixes: nodejs#21193
    AdityaSrivast committed Jun 19, 2018
    Configuration menu
    Copy the full SHA
    a8c61fd View commit details
    Browse the repository at this point in the history