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

Incorrect (throw-based) allocFunc for zlib1. Possible memory leak. [CORE6221] #6465

Closed
firebird-automations opened this issue Jan 10, 2020 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @ibprovider

https://www.zlib.net/manual.html

Usage of z_stream_s structure: zalloc must return Z_NULL if there is not enough memory for the object.

Firebird code, if I understood correctly, assign to zalloc throw-based allocation func:

void* allocFunc(void*, uInt items, uInt size)
{
return MemoryPool::globalAlloc(items * size ALLOC_ARGS); //thow ?
}

In deflateInit, for example, has five calls of zalloc function and has rollback of initialization if second (and next) call of zalloc return nullptr.

Commits: d27a422 908c660

@firebird-automations
Copy link
Collaborator Author

Modified by: @ibprovider

summary: Incorrect (throw-based) alloFunc for zlib1. Possible memory leak. => Incorrect (throw-based) allocFunc for zlib1. Possible memory leak.

@firebird-automations
Copy link
Collaborator Author

Modified by: @ibprovider

description: https://www.zlib.net/manual.html

Usage of z_stream_s structure: zalloc must return Z_NULL if there is not enough memory for the object.

Firebird code, if I understood correctly, assign to zalloc throw-based allocation func:

void* allocFunc(void*, uInt items, uInt size)
{
return MemoryPool::globalAlloc(items * size ALLOC_ARGS); //thow ?
}

In deflateInit, for example, has five calls of zalloc functions and has rollback of initialization if second (and next) call of zalloc return nullptr.

=>

https://www.zlib.net/manual.html

Usage of z_stream_s structure: zalloc must return Z_NULL if there is not enough memory for the object.

Firebird code, if I understood correctly, assign to zalloc throw-based allocation func:

void* allocFunc(void*, uInt items, uInt size)
{
return MemoryPool::globalAlloc(items * size ALLOC_ARGS); //thow ?
}

In deflateInit, for example, has five calls of zalloc function and has rollback of initialization if second (and next) call of zalloc return nullptr.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Open [ 1 ] => Open [ 1 ]

QA Status: No test => Cannot be tested

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Version: 4.0 Beta 1 [ 10750 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 2 [ 10888 ]

Fix Version: 3.0.6 [ 10889 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment