mirror of
https://github.com/darlinghq/darling-libxml2.git
synced 2025-02-07 19:16:27 +00:00
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
This commit is contained in:
parent
a6ea72ad19
commit
e036cb3160
10
trio.c
10
trio.c
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user