https://sourceforge.net/p/djvu/djvulibre-git/ci/cd8b5c97b27a5c1dc83046498b6ca49ad20aa9b6

Index: libdjvu/DjVuFile.cpp
--- libdjvu/DjVuFile.cpp.orig
+++ libdjvu/DjVuFile.cpp
@@ -576,6 +576,8 @@ DjVuFile::process_incl_chunk(ByteStream & str, int fil
     GURL incl_url=pcaster->id_to_url(this, incl_str);
     if (incl_url.is_empty())	// Fallback. Should never be used.
       incl_url=GURL::UTF8(incl_str,url.base());
+    if (incl_url == url)        // Infinite loop avoidance
+      G_THROW( ERR_MSG("DjVuFile.malformed") );
     
     // Now see if there is already a file with this *name* created
     {
