fix: fix invalid write on huge dac-sum input
This commit is contained in:
parent
06a547c350
commit
9c256a26ea
@ -2,24 +2,12 @@
|
|||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
|
|
||||||
struct ufd_t ufd__make_set(struct context_entry_t* thread)
|
|
||||||
{
|
|
||||||
struct ufd_children_t children = TAILQ_HEAD_INITIALIZER(children);
|
|
||||||
|
|
||||||
return (struct ufd_t) {
|
|
||||||
.thread = thread,
|
|
||||||
.parent = NULL,
|
|
||||||
.repr = NULL,
|
|
||||||
.children = children,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ufd__init(struct ufd_t* ufd, struct context_entry_t* thread)
|
void ufd__init(struct ufd_t* ufd, struct context_entry_t* thread)
|
||||||
{
|
{
|
||||||
TAILQ_INIT(&ufd->children);
|
TAILQ_INIT(&ufd->children);
|
||||||
ufd->thread = thread;
|
ufd->thread = thread;
|
||||||
ufd->repr = NULL,
|
ufd->repr = ufd,
|
||||||
ufd->parent = NULL;
|
ufd->parent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,13 +27,9 @@ void ufd__join(struct ufd_t* th1, struct ufd_t* th2)
|
|||||||
|
|
||||||
struct ufd_t* ufd__find(struct ufd_t* th)
|
struct ufd_t* ufd__find(struct ufd_t* th)
|
||||||
{
|
{
|
||||||
if (th->parent == NULL)
|
if (th->repr == th)
|
||||||
return th;
|
return th;
|
||||||
|
|
||||||
// If parent is null, repr can't be null
|
|
||||||
if (th->repr->parent == NULL)
|
|
||||||
return th->repr;
|
|
||||||
|
|
||||||
struct ufd_t* nrepr = ufd__find(th->repr);
|
struct ufd_t* nrepr = ufd__find(th->repr);
|
||||||
th->repr = nrepr;
|
th->repr = nrepr;
|
||||||
return nrepr;
|
return nrepr;
|
||||||
|
@ -14,8 +14,6 @@ struct ufd_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ufd_t ufd__make_set(struct context_entry_t* thread);
|
|
||||||
|
|
||||||
void ufd__init(struct ufd_t* ufd, struct context_entry_t* thread);
|
void ufd__init(struct ufd_t* ufd, struct context_entry_t* thread);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user