Fix CVE-2025-53367: potential buffer overflow in MMRDecoder
https://sourceforge.net/p/djvu/djvulibre-git/ci/33f645196593d70bd5e37f55b63886c31c82c3da/

Index: libdjvu/MMRDecoder.cpp
--- libdjvu/MMRDecoder.cpp.orig
+++ libdjvu/MMRDecoder.cpp
@@ -589,6 +589,9 @@ MMRDecoder::scanruns(const unsigned short **endptr)
   int a0,rle,b1;
   for(a0=0,rle=0,b1=*pr++;a0 < width;)
     {
+      // Check for buffer overflow
+      if (xr > lineruns+width+2 || pr > prevruns+width+2)
+        G_THROW(invalid_mmr_data);
       // Process MMR codes
       const int c=mrtable->decode(src);
       switch ( c )
@@ -714,7 +717,7 @@
                         rle++;
                         a0++;
                       }
-                    if (a0 > width)
+                    if (a0 > width || xr > lineruns+width+2)
                       G_THROW(invalid_mmr_data);
                   }
                 // Analyze uncompressed termination code.
