diff options
author | Gaurav Gupta <g.gupta@samsung.com> | 2014-07-14 21:22:07 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2014-07-14 21:22:07 +0800 |
commit | e036cb3160378d7c46f99434de07c065ebb05bc9 (patch) | |
tree | 892dc23506b833007d037e787f132413a65e644a | |
parent | a6ea72ad192f4209b5073e39358ce15f3f1dca4b (diff) | |
download | libxml2-e036cb3160378d7c46f99434de07c065ebb05bc9.tar.gz |
Avoid Possible Null Pointer in trio.c
For https://bugzilla.gnome.org/show_bug.cgi?id=730005
While using assert in libxml2 is really not a good idea, it's
still better to assert than crash
-rw-r--r-- | trio.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -6434,11 +6434,14 @@ TRIO_ARGS2((self, intPointer), trio_class_t *self, int *intPointer) { - FILE *file = (FILE *)self->location; + FILE *file; assert(VALID(self)); + assert(VALID(self->location)); assert(VALID(file)); + file = (FILE *)self->location; + self->current = fgetc(file); if (self->current == EOF) { @@ -6467,11 +6470,14 @@ TRIO_ARGS2((self, intPointer), trio_class_t *self, int *intPointer) { - int fd = *((int *)self->location); + int fd; int size; unsigned char input; assert(VALID(self)); + assert(VALID(self->location)); + + fd = *((int *)self->location); size = read(fd, &input, sizeof(char)); if (size == -1) |