From 16da4feac471b68af1138db0218aab81840fe17f Mon Sep 17 00:00:00 2001 From: zzjjbb <31069326+zzjjbb@users.noreply.github.com> Date: Fri, 6 Jun 2025 21:33:42 -0500 Subject: [PATCH] Fix memory error for AudioFifo properties Validate self.ptr before access: uninitialized properties should return None rather than crash the Python interpreter --- av/audio/fifo.pyx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/av/audio/fifo.pyx b/av/audio/fifo.pyx index 9b1380270..2ceb55f77 100644 --- a/av/audio/fifo.pyx +++ b/av/audio/fifo.pyx @@ -176,13 +176,19 @@ cdef class AudioFifo: @property def format(self): """The :class:`.AudioFormat` of this FIFO.""" + if not self.ptr: + raise AttributeError(f"'{__name__}.AudioFifo' object has no attribute 'format'") return self.template.format @property def layout(self): """The :class:`.AudioLayout` of this FIFO.""" + if not self.ptr: + raise AttributeError(f"'{__name__}.AudioFifo' object has no attribute 'layout'") return self.template.layout @property def sample_rate(self): + if not self.ptr: + raise AttributeError(f"'{__name__}.AudioFifo' object has no attribute 'sample_rate'") return self.template.sample_rate @property