Package: djvulibre
Severity: important

Hello,

I noticed that when I open in djview a file hosted on ntfs I always get a
segfault. The reason of it is not checking for the result of mmap() in
MemoryMapByteStream::init(). There are filesystems in linux that do not
support memory mapping (ntfs in linux 2.4.27). The patch that solves this
problem is attached. Please forward the patch/description to the upstream.

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.4.27-minimal
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)

--
Stanislav
--- a/libdjvu/ByteStream.cpp    2006-04-25 16:49:40.000000000 +0400
+++ b/libdjvu/ByteStream.cpp    2006-04-25 16:39:38.000000000 +0400
@@ -1255,9 +1255,12 @@
     {
       bsize=statbuf.st_size;
       data=(char *)mmap(0,statbuf.st_size,PROT_READ,MAP_SHARED,fd,0);
+      if(data == (char *)(-1))
+        goto mmap_error;
     }
   }else
   {
+mmap_error:
     if(closeme)
     {
       close(fd);

Reply via email to