-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(prefix): fix bug when buffer realloc occurs during prefix lookup
Prefix based lookup may need to reallocate the key/value buffer when the buffer size exceeds the default (currently 1MB). However, because we use the `ops[0]` and `ops[1]` passed in is used for both providing the `after` and `prefix`, in case of `NGX_AGAIN`, these will be overwritten by the `ngx_lua_resty_lmdb_ffi_prefix()` function to the first and second key respectively, which breaks the retry and causing the second call to `ngx_lua_resty_lmdb_ffi_prefix()` to return empty. This commit fixes the above issue by always resetting `ops[0]` and `ops[1]` between retries, therefore the above issue no longer occurs. Also, this commit fixes a use-after-free bug for `db_drop()` operation when map is full.
- Loading branch information
Showing
3 changed files
with
85 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters