Print this page
3999 libld extended section handling is broken

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/libld/common/syms.c
          +++ new/usr/src/cmd/sgs/libld/common/syms.c
↓ open down ↓ 2045 lines elided ↑ open up ↑
2046 2046                          int             shndx_bad = 0;
2047 2047                          int             symtab_enter = 1;
2048 2048  
2049 2049                          /*
2050 2050                           * Determine and validate the associated section index.
2051 2051                           */
2052 2052                          if (symshndx && (sym->st_shndx == SHN_XINDEX)) {
2053 2053                                  shndx = symshndx[ndx];
2054 2054                          } else if ((shndx = sym->st_shndx) >= SHN_LORESERVE) {
2055 2055                                  sdflags |= FLG_SY_SPECSEC;
2056      -                        } else if (shndx > ifl->ifl_ehdr->e_shnum) {
     2056 +                        } else if (shndx > ifl->ifl_shnum) {
2057 2057                                  /* We need the name before we can issue error */
2058 2058                                  shndx_bad = 1;
2059 2059                          }
2060 2060  
2061 2061                          /*
2062 2062                           * Check if st_name has a valid value or not.
2063 2063                           */
2064 2064                          if ((name = string(ofl, ifl, sym, strs, strsize, ndx,
2065 2065                              shndx, symsecndx, symsecname, strsecname,
2066 2066                              &sdflags)) == NULL)
↓ open down ↓ 294 lines elided ↑ open up ↑
2361 2361                  Cap_pair        *cpp = NULL;
2362 2362                  uchar_t         ntype;
2363 2363  
2364 2364                  /*
2365 2365                   * Determine and validate the associated section index.
2366 2366                   */
2367 2367                  if (symshndx && (nsym->st_shndx == SHN_XINDEX)) {
2368 2368                          shndx = symshndx[ndx];
2369 2369                  } else if ((shndx = nsym->st_shndx) >= SHN_LORESERVE) {
2370 2370                          sdflags |= FLG_SY_SPECSEC;
2371      -                } else if (shndx > ifl->ifl_ehdr->e_shnum) {
     2371 +                } else if (shndx > ifl->ifl_shnum) {
2372 2372                          /* We need the name before we can issue error */
2373 2373                          shndx_bad = 1;
2374 2374                  }
2375 2375  
2376 2376                  /*
2377 2377                   * Check if st_name has a valid value or not.
2378 2378                   */
2379 2379                  if ((name = string(ofl, ifl, nsym, strs, strsize, ndx, shndx,
2380 2380                      symsecndx, symsecname, strsecname, &sdflags)) == NULL)
2381 2381                          continue;
↓ open down ↓ 754 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX