jart / bestline

ANSI Standard X3.64 Teletypewriter Command Session Library
Other
443 stars 29 forks source link

Fix underflow in IsBalanced() #29

Closed dimkr closed 1 year ago

dimkr commented 1 year ago

That d <= 0 indicates that this function is supposed to return 0 and not 1 when the input is something like a ). However, d is unsigned, so unsigned d = 0 - 1 = 0xffffffff and IsBalanced() returns 1.