Skip to contentSkip to conversation

dib8000: enhancement

media Dan Carpenter 1 participant 1 message Nov 26, 2013 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hello Patrick Boettcher,

The patch 173a64cb3fcf: "[media] dib8000: enhancement" from Apr 22, 2013, leads to the following static checker warning: "drivers/media/dvb-frontends/dib8000.c:2074 dib8000_get_init_prbs()

	 error: buffer overflow 'lut_prbs_8k' 14 <= 14"

drivers/media/dvb-frontends/dib8000.c
3176 case CT_DEMOD_STEP_11: /* 41 : init prbs autosearch */

  3177                          if (state->subchannel <= 41) {
                                    ^^^^^^^^^^^^^^^^^^^^^^^
  3178                                  dib8000_set_subchannel_prbs(state, dib8000_get_init_prbs(state, state->subchannel));
                                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If state->subchannel == 41 then we go one space beyond the end of the arrays in dib8000_get_init_prbs(). "41 / 3 + 1" is 14 and there are only 14 elements in the arrays so we are reading one space beyond the end of the array.

  3179                                  *tune_state = CT_DEMOD_STEP_9;
  3180                          } else {
  3181                                  *tune_state = CT_DEMOD_STOP;
  3182                                  state->status = FE_STATUS_TUNE_FAILED;
  3183                          }
  3184                          break;
  3185  

regards,
dan carpenter