diff -Naur fdk-aac-2.0.2/libDRCdec/src/drcDec_reader.cpp fdk-aac-2.0.2-patched/libDRCdec/src/drcDec_reader.cpp
--- fdk-aac-2.0.2/libDRCdec/src/drcDec_reader.cpp	2021-04-28 15:45:10.000000000 +0200
+++ fdk-aac-2.0.2-patched/libDRCdec/src/drcDec_reader.cpp	2021-11-24 13:38:48.000000000 +0100
@@ -512,10 +512,13 @@
               fMin(tmpNNodes, (UCHAR)16) * sizeof(GAIN_NODE));
   }
 
-  hUniDrcGain->uniDrcGainExtPresent = FDKreadBits(hBs, 1);
-  if (hUniDrcGain->uniDrcGainExtPresent == 1) {
-    err = _readUniDrcGainExtension(hBs, &(hUniDrcGain->uniDrcGainExtension));
-    if (err) return err;
+  if (pCoef && (gainSequenceCount ==
+                pCoef->gainSequenceCount)) { /* all sequences have been read */
+    hUniDrcGain->uniDrcGainExtPresent = FDKreadBits(hBs, 1);
+    if (hUniDrcGain->uniDrcGainExtPresent == 1) {
+      err = _readUniDrcGainExtension(hBs, &(hUniDrcGain->uniDrcGainExtension));
+      if (err) return err;
+    }
   }
 
   if (err == DE_OK && gainSequenceCount > 0) {
