Issue Details (XML | Word | Printable)

Key: CORE-6221
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Kovalenko Dmitry
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Incorrect (throw-based) allocFunc for zlib1. Possible memory leak.

Created: 10/Jan/20 08:02 AM   Updated: 10/Jan/20 11:01 AM
Component/s: None
Affects Version/s: 4.0 Beta 1, 3.0.5
Fix Version/s: 4.0 Beta 2, 3.0.6

QA Status: Cannot be tested


 Description  « Hide
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.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Kovalenko Dmitry made changes - 10/Jan/20 08:02 AM
Field Original Value New Value
Summary Incorrect (throw-based) alloFunc for zlib1. Possible memory leak. Incorrect (throw-based) allocFunc for zlib1. Possible memory leak.
Kovalenko Dmitry made changes - 10/Jan/20 08:03 AM
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.
Alexander Peshkov made changes - 10/Jan/20 09:54 AM
Assignee Alexander Peshkov [ alexpeshkoff ]
Pavel Zotov made changes - 10/Jan/20 10:57 AM
Status Open [ 1 ] Open [ 1 ]
QA Status No test Cannot be tested
Alexander Peshkov made changes - 10/Jan/20 11:01 AM
Affects Version/s 4.0 Beta 1 [ 10750 ]
Alexander Peshkov made changes - 10/Jan/20 11:01 AM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 4.0 Beta 2 [ 10888 ]
Fix Version/s 3.0.6 [ 10889 ]
Resolution Fixed [ 1 ]