Print this page
11414 Fix smatch issue in libdemangle

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdemangle/common/rust.c
          +++ new/usr/src/lib/libdemangle/common/rust.c
↓ open down ↓ 231 lines elided ↑ open up ↑
 232  232          sv_init_sv(&sv, svp);
 233  233  
 234  234          if (!rustdem_parse_num(st, &sv, &len)) {
 235  235                  DEMDEBUG("ERROR: no leading length");
 236  236                  st->rds_error = EINVAL;
 237  237                  return (B_FALSE);
 238  238          }
 239  239  
 240  240          rem = sv_remaining(&sv);
 241  241  
 242      -        if (rem < len || len > SIZE_MAX) {
      242 +        if (rem < len || len == SIZE_MAX) {
 243  243                  st->rds_error = EINVAL;
 244  244                  return (B_FALSE);
 245  245          }
 246  246  
 247  247          /* Is this the last segment before the terminating E? */
 248  248          if (rem == len + 1) {
 249  249                  VERIFY3U(sv_peek(&sv, -1), ==, 'E');
 250  250                  last = B_TRUE;
 251  251          }
 252  252  
↓ open down ↓ 291 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX