Ticket created by ~mcf on ~lattis/muon
$ muon samu -j 0 Segmentation faultninja supports
-j 0
to mean "start unlimited jobs in parallel", analogous tomake -j
. samurai setsbuildopts.maxjobs = -1
in this case (e.g.SIZE_MAX
).However, since muon's samurai allocates all
maxjobs
upfront, this causes an attempted allocation ofSIZE_MAX
jobs. Even thoughsamu_arena_alloc
can't fail,SIZE_MAX * sizeof(jobs[0])
is larger thanSIZE_MAX
, sosamu_reallocarray
fails and returns NULL. Then, whensamu_build()
tries to access theNULL
array, it crashes.Here are some possible solutions:
- Don't support
-j 0
. I'm not convinced that unlimited parallelism is a good feature, so it's probably fine to not support it (changenum < 0
tonum <= 0
insamu_jobsflag()
).- Since muon samurai uses it's own job spawning code, it doesn't have to keep a
pollfd
array, so you could allocate the job structs separately and makejobs
a linked list.In either case, I think the
fatal
should be added back tosamu_xreallocarray
, since callers expect that it always succeeds.
This error indicates that the code had some read of a variable before it was initialized. While I think qbe should accept this, it usually indicates some sort of bug in the code. Here, it was due to some unused variable warning suppressions
(void)key
, prior to their initialization.This is fixed in muon 0.4.0.
REPORTED
RESOLVED NOT_OUR_BUGUnfortunately, it seems that the attachment didn't make it's way to the issue. Could you upload it somewhere or email it to me personally?
Thanks for reporting this. You're right that unions are allowed to contain structs with FAMs, I had misinterpreted the standard text.
It says
such a structure (and any union containing, possibly recursively, a member that is such a structure) shall not be a member of a structure or an element of an array
So while you can't have a struct containing a struct with a FAM, a union containing a struct with a FAM is fine. This should be fixed in a2ddee1be6.
REPORTED
RESOLVED FIXEDNihal Jere referenced this ticket in commit 4f206ac.
Nihal Jere referenced this ticket in commit 4f206ac.
REPORTED
RESOLVED IMPLEMENTED