[Libreoffice-bugs] [Bug 127648] LO on Linux crashes when accessing opend/locked File on SAMBA network share

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sun Mar 29 12:03:48 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=127648

--- Comment #27 from Theofilos Intzoglou <int.teo at gmail.com> ---
I created a sample c program to test if the samba server or client reports
something wrong when a file is open:

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>

void printerr(void) {
        printf("%s\n", strerror(errno));
        exit(errno);
}

int main(void) {
    int fd;
    struct stat statbuf;
    int res;
    char buf[4096];

    fd = openat(AT_FDCWD, "/mnt/disk/cv.doc", O_RDONLY);
    if (fd == -1)
        printerr();

    res = fstat(fd, &statbuf);
    if (res == -1)
        printerr();
    printf("st_mode=%d\nst_size=%ld\n", statbuf.st_mode, statbuf.st_size);
    res = pread64(fd, &buf, 4096, 0);
    printf("%d\n", res);
    close(fd);
    exit(0);
}

I have created a simple public samba share with just the cv.doc file and
mounted the share in /mnt/disk with the following command:

mount -t cifs //pc/public /mnt/disk -o guest,rw,_netdev,uid=user,vers=1.0

If libreoffice is closed and I run the above program, I get:
st_mode=33261
st_size=11398
4096

where 4096 is the number of bytes read. If I open cv.doc with libreoffice and
rerun the program I get:
st_mode=33261
st_size=11398
-13

The error is reported successfully as it seems. nrc is an unsigned int as it is
declared as an sal_uInt64 so the 4294967283 value is justified. Is it really
not a bug of libreoffice? Unfortunately I cannot fully understand the
libreoffice code to detect the problem :-(

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200329/7f182054/attachment.htm>


More information about the Libreoffice-bugs mailing list