Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@eeshan9815
Copy link
Contributor

The issue is that the variable size is of the type size_t, which is an unsigned integer.

Passing a negative value leads to an integer overflow, and the requested size is in the order of 2^64 bytes, which is over 10^10 GB, leading to a heap overflow.

Calling the window function will now lead to an error (ERROR: allocation size cannot be negative) instead of crashing.

The issue is that the variable `size` is of the type `size_t`, which is an unsigned integer. 

Passing a negative value leads to an integer overflow, and the requested size is in the order of 2^64 bytes, which is over 10^10 GB, leading to a heap overflow. 

Calling the window function will now lead to an error (ERROR:  allocation size cannot be negative) instead of crashing.
@eeshan9815 eeshan9815 marked this pull request as draft October 29, 2024 09:01
@eeshan9815 eeshan9815 marked this pull request as ready for review October 29, 2024 09:09
@eeshan9815 eeshan9815 changed the title Fix possible heap overflow in Window Functions Fix possible overflow in Window Functions Oct 29, 2024
@JerrySievert
Copy link
Member

thanks much! letting the tests run now

@JerrySievert JerrySievert merged commit f99ee0e into plv8:3.2.4-dev Nov 1, 2024
5 checks passed
JerrySievert pushed a commit that referenced this pull request Jul 5, 2025
* Fix possible heap overflow in Window Functions

The issue is that the variable `size` is of the type `size_t`, which is an unsigned integer. 

Passing a negative value leads to an integer overflow, and the requested size is in the order of 2^64 bytes, which is over 10^10 GB, leading to a heap overflow. 

Calling the window function will now lead to an error (ERROR:  allocation size cannot be negative) instead of crashing.

* Add v8 namespace to String usage to fix build errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants