rubund / graywolf

Other
107 stars 36 forks source link

Bug in twsc/netgraph.c #20

Closed RTimothyEdwards closed 6 years ago

RTimothyEdwards commented 6 years ago

An efabless user was testing the synthesis flow with a tiny two-gate design, and graywolf appears to have issues with either the low gate count or more likely the low pin count, causing a segfault. Debugging with valgrind, it appears that variable z_S is not allocating enough memory for the array.

Line 949 in twsc/netgraph.c: z_S[i] = (PINBOXPTR )Ysafe_malloc( maxpin_numberS sizeof(PINBOXPTR) ) ;

should be: z_S[i] = (PINBOXPTR )Ysafe_malloc( ( maxpin_numberS + 1 ) sizeof(PINBOXPTR) ) ;

The same change needs to be made to line 183.

---Tim

rubund commented 6 years ago

Thank you Tim: https://github.com/rubund/graywolf/commit/d42f1c46f45bf6e72c7d4b2fd65c2f0691561bd7