google / bloaty

Bloaty: a size profiler for binaries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The order of condition judgement is illogical in bloaty::ReadEncodedPointer(eh_frame.cc).

ych opened this issue · comments

commented

In function bloaty::ReadEncodedPointer

  uint8_t format = encoding & DW_EH_PE_FORMAT_MASK;

  switch (format) {
    case DW_EH_PE_omit:

The code tries to do AND operation with DW_EH_PE_FORMAT_MASK(0xf) and tries to meet DW_EH_PE_omit(0xff), but it is not possible to happen.

I try to find some example code:
https://github.com/torvalds/linux/blob/master/tools/perf/util/unwind-libunwind-local.c#L112

The code tries to compare with DW_EH_PE_omit first then do AND operation with DW_EH_PE_FORMAT_MASK.