node-ldapjs icon indicating copy to clipboard operation
node-ldapjs copied to clipboard

Bug in Client enqueue

Open snytkine opened this issue 2 years ago • 3 comments

I was just going over the code in ldapjs version 2.3.3

In file lib/client/request-queue/enqueue.js there are lines around line 17 if (this._queue.length >= this.size || this._frozen) { return false }

I think this is a bug because the this._queue is a Set, not an Array. Set does not have the length property, it has the size

This bug will result if this condition to always evaluate to false, so setting the queue size will have no effect, the queue will always behave as if can take unlimited number of items. Potentially can cause serious memory leak.

snytkine avatar Sep 21 '22 09:09 snytkine

Can you highlight where this._queue is defined as a set?

jsumners avatar Sep 22 '22 13:09 jsumners

This is where _queue is defined: lib/client/request-queue/index.js

Line 23 _queue: new Set()

snytkine avatar Sep 23 '22 10:09 snytkine

Please use https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet

jsumners avatar Sep 23 '22 11:09 jsumners

⚠️ This issue has been locked due to age. If you have encountered a recent problem that seems to be covered by this issue, please open a new issue.

Please include a minimal reproducible example when opening a new issue.

jsumners avatar Mar 10 '23 13:03 jsumners