Skip to content

Commit 434b6cc

Browse files
authored
Merge pull request #178 from maxmind/greg/eng-1019
Check MMDB_get_metadata_as_entry_data_list return value
2 parents a93a344 + 4501f20 commit 434b6cc

File tree

6 files changed

+23
-1
lines changed

6 files changed

+23
-1
lines changed

.github/workflows/clang-addresssanitizer.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
schedule:
77
- cron: '53 3 * * SUN'
88

9+
permissions: {}
10+
911
jobs:
1012
addresssanitizer:
1113
name: Clang AddressSanitizer

.github/workflows/clang-analyzer.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
schedule:
77
- cron: '45 3 * * SUN'
88

9+
permissions: {}
10+
911
jobs:
1012
run:
1113
name: "Clang Static Analysis"

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
schedule:
77
- cron: '45 3 * * SUN'
88

9+
permissions: {}
10+
911
jobs:
1012
run:
1113
runs-on: ubuntu-latest

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
schedule:
77
- cron: '45 3 * * SUN'
88

9+
permissions: {}
10+
911
jobs:
1012
run:
1113
runs-on: ${{ matrix.operating-system }}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
1.12.1
5+
-------------------
6+
7+
* The C extension now checks that the database metadata lookup was
8+
successful.
9+
410
1.12.0 (2024-11-14)
511
-------------------
612

ext/maxminddb.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,15 @@ PHP_METHOD(MaxMind_Db_Reader, metadata) {
336336
object_init_ex(return_value, metadata_ce);
337337

338338
MMDB_entry_data_list_s *entry_data_list;
339-
MMDB_get_metadata_as_entry_data_list(mmdb_obj->mmdb, &entry_data_list);
339+
int status =
340+
MMDB_get_metadata_as_entry_data_list(mmdb_obj->mmdb, &entry_data_list);
341+
if (status != MMDB_SUCCESS) {
342+
zend_throw_exception_ex(maxminddb_exception_ce,
343+
0 TSRMLS_CC,
344+
"Error while decoding metadata. %s",
345+
MMDB_strerror(status));
346+
return;
347+
}
340348

341349
zval metadata_array;
342350
const MMDB_entry_data_list_s *rv =

0 commit comments

Comments
 (0)