Changeset: af12e9ab36ab for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=af12e9ab36ab
Modified Files:
        monetdb5/mal/mal_import.c
Branch: default
Log Message:

Protect against access to null file descriptor
The interface of stream seem to have chanced.
It did not raise the error properly,leaving the upper layer with
an zero file descriptor


diffs (28 lines):

diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -262,8 +262,8 @@ evalFile(Client c, str fname, int listin
        while ((p = strchr(filename, PATH_SEP)) != NULL) {
                *p = '\0';
                fd = malOpenSource(filename);
-               if (mnstr_errnr(fd) == MNSTR_OPEN_ERROR) {
-                       mnstr_destroy(fd);
+               if (fd == 0 || mnstr_errnr(fd) == MNSTR_OPEN_ERROR) {
+                       if(fd) mnstr_destroy(fd);
                        mnstr_printf(c->fdout, "#WARNING: could not open file: 
%s\n",
                                        filename);
                } else {
@@ -277,10 +277,9 @@ evalFile(Client c, str fname, int listin
                filename = p + 1;
        }
        fd = malOpenSource(filename);
-       if (mnstr_errnr(fd) == MNSTR_OPEN_ERROR) {
-               mnstr_destroy(fd);
-               mnstr_printf(c->fdout, "#WARNING: could not open file: %s\n",
-                               filename);
+       if (fd == 0 || mnstr_errnr(fd) == MNSTR_OPEN_ERROR) {
+               if( fd == 0) mnstr_destroy(fd);
+               msg = createException(MAL,"mal.eval", "WARNING: could not open 
file: %s\n", filename);
        } else {
                c->srcFile = filename;
                c->yycur = 0;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to