Skip to content

Commit

Permalink
Fix out of bounds memory access in depth unpacking
Browse files Browse the repository at this point in the history
Signed-off-by: Hector Martin <[email protected]>
  • Loading branch information
marcan committed Nov 27, 2010
1 parent 767c49b commit c8211fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cameras.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ static inline void convert_packed_to_16bit(uint8_t *raw, uint16_t *frame, int vw
int bitshift = 0;
for (i=0; i<(640*480); i++) {
int idx = (i*vw)/8;
uint32_t word = (raw[idx]<<(16)) | (raw[idx+1]<<8) | raw[idx+2];
uint32_t word = (raw[idx]<<(16)) | (raw[idx+1]<<8);
if (bitshift > (16-vw))
word |= raw[idx+2];
frame[i] = ((word >> (((3*8)-vw)-bitshift)) & mask);
bitshift = (bitshift + vw) % 8;
}
Expand Down

0 comments on commit c8211fd

Please sign in to comment.