Skip to content

The compileTrust function exhibits issues when processing exceptionally long strings. #6612

Closed
@xzyingxiashubro

Description

@xzyingxiashubro

Environment information

Version: express 5.0.0-beta.3

Platform: Linux

Node.js version: 18.x

Any other relevant information: N/A

What steps will reproduce the bug?

  1. Create a very long string with many IP addresses separated by commas
  2. Call the compileTrust function with this string
  3. Call the returned function and check its length
const utils = require('./lib/utils');

// Create a string with 1,000,001 IP addresses
const longString = Array(1000001).fill('127.0.0.1').join(',');

// Call compileTrust with the long string
const result = utils.compileTrust(longString);

// Check the length of the result when called
console.log(result().length); // Expected: 1000001, Actual: undefined

What is the expected behavior?

The function should correctly process the very long string, split it into an array of IP addresses, and return a function that, when called, returns an array with 1,000,001 elements (one for each IP address in the original string).

What happens instead?

When calling the result function and checking its length, it returns undefined instead of the expected value of 1,000,001.

When processing a string input, the function splits the string and maps the values, but doesn't ensure the returned function properly returns the processed array for very long inputs. There's inconsistency in how the function handles string inputs compared to other input types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions