1- /* This file is part of the libmdbx amalgamated source code (v0.14.1-521-gb2ff247e at 2026-03-30T18:07:04 +03:00).
1+ /* This file is part of the libmdbx amalgamated source code (v0.14.1-524-gba1be46d at 2026-03-31T02:48:49 +03:00).
22 *
33 * libmdbx (aka MDBX) is an extremely fast, compact, powerful, embeddedable, transactional key-value storage engine with
44 * open-source code. MDBX has a specific set of properties and capabilities, focused on creating unique lightweight
@@ -26474,19 +26474,12 @@ __cold void page_list(page_t *mp) {
2647426474
2647526475#if MDBX_CHECKING >= 0
2647626476
26477- static bool osal_safe_read_uint32(const void *ptr, int32_t *dest) {
26478- *dest = 0;
26479- /* TODO: FIXME */
26480- (void)ptr;
26481- return false;
26482- }
26483-
2648426477__cold const char *object2class(const void *ptr) {
2648526478 if (!ptr)
2648626479 return "null";
2648726480
2648826481 int32_t snap_signature = 0;
26489- if (!osal_safe_read_uint32 (ptr, &snap_signature))
26482+ if (!osal_safe_peek_uint32 (ptr, &snap_signature))
2649026483 return "bad";
2649126484
2649226485 switch (snap_signature) {
@@ -26505,7 +26498,7 @@ __cold const char *object2class(const void *ptr) {
2650526498 return "unknown";
2650626499}
2650726500
26508- MDBX_NORETURN static void panic_kick (const char *msg, const char *func, unsigned line, const void *obj) {
26501+ MDBX_NORETURN static void fuckup (const char *msg, const char *func, unsigned line, const void *obj) {
2650926502 const char *obj_class = object2class(obj);
2651026503 MDBX_DTRACE5(panic, func, line, msg, obj_class, obj);
2651126504 const MDBX_panic_func panic_func = globals.panic_func;
@@ -26516,7 +26509,7 @@ MDBX_NORETURN static void panic_kick(const char *msg, const char *func, unsigned
2651626509}
2651726510
2651826511__cold __noinline void panic_at_obj(const struct MDBX_panic_point *const at, const void *obj) {
26519- panic_kick (at->msg, at->function, at->line, obj);
26512+ fuckup (at->msg, at->function, at->line, obj);
2652026513}
2652126514
2652226515__cold __noinline void panic_at(const struct MDBX_panic_point *const at) { panic_at_obj(at, nullptr); }
@@ -26527,9 +26520,11 @@ __cold __noinline void panic_at_fmt(const struct MDBX_panic_point *const at, con
2652726520 char *message = nullptr;
2652826521 const int num = osal_vasprintf(&message, obj, ap);
2652926522 const char *const const_message = unlikely(num < 1 || !message) ? "<vasprintf() failed>" : message;
26530- panic_kick (const_message, at->function, at->line, obj);
26523+ fuckup (const_message, at->function, at->line, obj);
2653126524}
2653226525
26526+ __cold void mdbx_assert_fail(const char *msg, const char *func, unsigned line) { fuckup(msg, func, line, nullptr); }
26527+
2653326528#endif /* MDBX_CHECKING >= 0 */
2653426529
2653526530typedef struct meta_snap {
@@ -29036,6 +29031,10 @@ bool osal_pathequal(const pathchar_t *l, const pathchar_t *r, size_t len) {
2903629031#endif
2903729032}
2903829033
29034+ #if !(defined(_WIN32) || defined(_WIN64))
29035+ static const char dev_null[] = "/dev/null";
29036+ #endif /* !Windows */
29037+
2903929038int osal_openfile(const enum osal_openfile_purpose purpose, const MDBX_env *env, const pathchar_t *pathname,
2904029039 mdbx_filehandle_t *fd, mdbx_mode_t unix_mode_bits) {
2904129040 *fd = INVALID_HANDLE_VALUE;
@@ -29163,7 +29162,6 @@ int osal_openfile(const enum osal_openfile_purpose purpose, const MDBX_env *env,
2916329162 /* Safeguard for https://libmdbx.dqdkfa.ru/dead-github/issues/144 */
2916429163#if STDIN_FILENO == 0 && STDOUT_FILENO == 1 && STDERR_FILENO == 2
2916529164 int stub_fd0 = -1, stub_fd1 = -1, stub_fd2 = -1;
29166- static const char dev_null[] = "/dev/null";
2916729165 if (!is_valid_fd(STDIN_FILENO)) {
2916829166 WARNING("STD%s_FILENO/%d is invalid, open %s for temporary stub", "IN", STDIN_FILENO, dev_null);
2916929167 stub_fd0 = open(dev_null, O_RDONLY | O_NOCTTY);
@@ -31385,6 +31383,36 @@ const char *osal_getenv(const char *name, bool secure) {
3138531383#endif
3138631384}
3138731385
31386+ bool osal_safe_peek_uint32(const void *ptr, int32_t *dest) {
31387+ bool done = false;
31388+ *dest = 0;
31389+ #if defined(_WIN32) || defined(_WIN64)
31390+ __try {
31391+ if (IsBadReadPtr(ptr, 4) == 0) {
31392+ memcpy(dest, ptr, 4);
31393+ done = true;
31394+ }
31395+ } __except (EXCEPTION_EXECUTE_HANDLER) {
31396+ return false;
31397+ ;
31398+ }
31399+ #else
31400+ static int nullfd = -1;
31401+ if (nullfd < 0) {
31402+ nullfd = open(dev_null, O_WRONLY
31403+ #ifdef O_CLOEXEC
31404+ | O_CLOEXEC
31405+ #endif /* O_CLOEXEC */
31406+ );
31407+ }
31408+ if (write(nullfd, ptr, 4) == 4) {
31409+ memcpy(dest, ptr, 4);
31410+ done = true;
31411+ }
31412+ #endif
31413+ return done;
31414+ }
31415+
3138831416/*--------------------------------------------------------------------------*/
3138931417
3139031418void osal_ctor(void) {
@@ -40227,10 +40255,10 @@ __dll_export
4022740255 0,
4022840256 14,
4022940257 1,
40230- 521 ,
40258+ 524 ,
4023140259 "", /* pre-release suffix of SemVer
40232- 0.14.1.521 */
40233- {"2026-03-30T18:07:04 +03:00", "1e32d4c79f8feb451e687c4e4e323deaf7723e11 ", "b2ff247e2e49c93b3ff78f5a9e2eab260d2a89d1 ", "v0.14.1-521-gb2ff247e "},
40260+ 0.14.1.524 */
40261+ {"2026-03-31T02:48:49 +03:00", "532377bcb1496286a8b1017c6117dba576fd559c ", "ba1be46d6b6742802ec4ecde52ba6569eb81724b ", "v0.14.1-524-gba1be46d "},
4023440262 sourcery};
4023540263
4023640264__dll_export
0 commit comments