Skip to content

Commit

Permalink
Merge pull request #178 from maxmind/greg/eng-1019
Browse files Browse the repository at this point in the history
Check MMDB_get_metadata_as_entry_data_list return value
  • Loading branch information
horgh authored Jan 27, 2025
2 parents a93a344 + 4501f20 commit 434b6cc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/clang-addresssanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
schedule:
- cron: '53 3 * * SUN'

permissions: {}

jobs:
addresssanitizer:
name: Clang AddressSanitizer
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/clang-analyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
schedule:
- cron: '45 3 * * SUN'

permissions: {}

jobs:
run:
name: "Clang Static Analysis"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
schedule:
- cron: '45 3 * * SUN'

permissions: {}

jobs:
run:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
schedule:
- cron: '45 3 * * SUN'

permissions: {}

jobs:
run:
runs-on: ${{ matrix.operating-system }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
=========

1.12.1
-------------------

* The C extension now checks that the database metadata lookup was
successful.

1.12.0 (2024-11-14)
-------------------

Expand Down
10 changes: 9 additions & 1 deletion ext/maxminddb.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,15 @@ PHP_METHOD(MaxMind_Db_Reader, metadata) {
object_init_ex(return_value, metadata_ce);

MMDB_entry_data_list_s *entry_data_list;
MMDB_get_metadata_as_entry_data_list(mmdb_obj->mmdb, &entry_data_list);
int status =
MMDB_get_metadata_as_entry_data_list(mmdb_obj->mmdb, &entry_data_list);
if (status != MMDB_SUCCESS) {
zend_throw_exception_ex(maxminddb_exception_ce,
0 TSRMLS_CC,
"Error while decoding metadata. %s",
MMDB_strerror(status));
return;
}

zval metadata_array;
const MMDB_entry_data_list_s *rv =
Expand Down

0 comments on commit 434b6cc

Please sign in to comment.