Page MenuHomePhabricator Dev

Bug 1854965 - Apply mozilla patches for libogg
Needs ReviewPublic

Authored by update-bot on Dec 16 2025, 12:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 11, 10:17 AM
Unknown Object (File)
Thu, Oct 1, 6:48 AM
Unknown Object (File)
Thu, Sep 24, 5:23 AM
Unknown Object (File)
Aug 9 2026, 5:06 AM
Unknown Object (File)
Aug 5 2026, 9:21 PM
Unknown Object (File)
Aug 5 2026, 6:42 AM
Unknown Object (File)
Aug 1 2026, 5:43 AM
Unknown Object (File)
Jul 30 2026, 4:46 AM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Bugzilla Bug ID
1854965

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Branch
default

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: Restricted Project.

Code Review Summarization

1. Intent

The changes aim to apply Mozilla-specific patches to the libogg library during its update to version 1.3.6. Specifically, these modifications enable custom memory allocation functions to be used instead of the standard C library memory functions (malloc, calloc, realloc, free). This is necessary to accommodate Firefox's memory reporting infrastructure, which requires tracking and monitoring memory allocations made by third-party libraries within the browser environment.

2. Solution

The solution replaces the original static memory allocation macros with a dynamic system based on function pointers:

In os_types.h: The original preprocessor definitions that directly mapped memory allocation functions to standard library functions are removed. Instead, type definitions for custom memory allocation function signatures are introduced, along with extern declarations for global function pointers. The original macro names are redefined to point to these function pointers rather than directly to the standard library functions. C++ compatibility is ensured through extern C linkage guards.

In ogg_alloc.c: A new source file is created that initializes the global function pointers with the standard library memory functions as defaults. It also implements a setter function that allows external code to override these function pointers at runtime with custom implementations.

In ogg.h: The public API is extended by adding a declaration for the new setter function, making it available to library users who need to configure custom memory allocation handlers.

This approach maintains backward compatibility while enabling Firefox to inject its own memory tracking implementations at runtime.

<budget:token_budget>
Tokens used: 1422
Percentage of budget used: 0.71%
</budget:token_budget>


Please use / reactions on inline comments to provide feedback. This will have a significant impact on the quality of future reviews.
media/libogg/src/ogg_alloc.c
27

Add NULL checks for all function pointer parameters. If NULL is passed, subsequent memory allocations will crash.

27

The assignments create data races if called concurrently with memory allocations or from multiple threads. Add synchronization or document that this function must only be called during single-threaded initialization before any ogg library usage.