Fail properly when encountering removed or 0-byte regions
Resolves: #1471011
This commit is contained in:
parent
eb2e4bfeeb
commit
ee7752ae54
39
libdb-5.3.21-region-size-check.patch
Normal file
39
libdb-5.3.21-region-size-check.patch
Normal file
@ -0,0 +1,39 @@
|
||||
diff -up db-5.3.21/src/env/env_region.c.zero-region db-5.3.21/src/env/env_region.c
|
||||
--- db-5.3.21/src/env/env_region.c.zero-region 2012-05-11 19:57:53.000000000 +0200
|
||||
+++ db-5.3.21/src/env/env_region.c 2017-09-06 08:50:45.310276385 +0200
|
||||
@@ -1060,6 +1060,7 @@ __env_region_attach(env, infop, init, ma
|
||||
REGION *rp;
|
||||
int ret;
|
||||
char buf[sizeof(DB_REGION_FMT) + 20];
|
||||
+ struct stat st;
|
||||
|
||||
/*
|
||||
* Find or create a REGION structure for this region. If we create
|
||||
@@ -1090,6 +1091,14 @@ __env_region_attach(env, infop, init, ma
|
||||
if ((ret = __env_sys_attach(env, infop, rp)) != 0)
|
||||
goto err;
|
||||
|
||||
+ /* Check the size of the underlying file */
|
||||
+ if (infop->fhp != NULL && F_ISSET(infop->fhp, DB_FH_OPENED) &&
|
||||
+ infop->fhp->fd != -1 && fstat(infop->fhp->fd, &st) != -1 &&
|
||||
+ st.st_size == 0) {
|
||||
+ ret = DB_RUNRECOVERY;
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Fault the pages into memory. Note, do this BEFORE we initialize
|
||||
* anything because we're writing pages in created regions, not just
|
||||
diff -up db-5.3.21/src/os/os_map.c.zero-region db-5.3.21/src/os/os_map.c
|
||||
--- db-5.3.21/src/os/os_map.c.zero-region 2012-05-11 19:57:54.000000000 +0200
|
||||
+++ db-5.3.21/src/os/os_map.c 2017-09-06 08:49:39.144546552 +0200
|
||||
@@ -265,6 +265,9 @@ __os_detach(env, infop, destroy)
|
||||
dbenv = env->dbenv;
|
||||
|
||||
rp = infop->rp;
|
||||
+ /* Do not touch the region information if it no longer exists */
|
||||
+ if (rp == NULL)
|
||||
+ return EINVAL;
|
||||
|
||||
/* If the user replaced the unmap call, call through their interface. */
|
||||
if (DB_GLOBAL(j_region_unmap) != NULL)
|
@ -4,7 +4,7 @@
|
||||
Summary: The Berkeley DB database library for C
|
||||
Name: libdb
|
||||
Version: 5.3.28
|
||||
Release: 26%{?dist}
|
||||
Release: 27%{?dist}
|
||||
Source0: http://download.oracle.com/berkeley-db/db-%{version}.tar.gz
|
||||
Source1: http://download.oracle.com/berkeley-db/db.1.85.tar.gz
|
||||
# For mt19937db.c
|
||||
@ -42,6 +42,7 @@ Patch31: db-5.3.28-condition-variable-ppc.patch
|
||||
Patch32: db-5.3.28-rpm-lock-check.patch
|
||||
# downstream patch to hotfix rhbz#1464033, sent upstream
|
||||
Patch33: db-5.3.28-cwd-db_config.patch
|
||||
Patch34: libdb-5.3.21-region-size-check.patch
|
||||
|
||||
URL: http://www.oracle.com/database/berkeley-db/
|
||||
License: BSD and LGPLv2 and Sleepycat
|
||||
@ -238,6 +239,7 @@ popd
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
%patch33 -p1
|
||||
%patch34 -p1
|
||||
|
||||
cd dist
|
||||
./s_config
|
||||
@ -446,6 +448,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%{_libdir}/libdb_java.so
|
||||
|
||||
%changelog
|
||||
* Thu Sep 07 2017 Petr Kubat <pkubat@redhat.com> 5.3.21-27
|
||||
- Fail properly when encountering removed or 0-byte regions (#1471011)
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.28-26
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user