Skip to content

Commit 4d3e680

Browse files
quariumcmassiot
authored andcommitted
upipe_s337_encaps: fix integer left shift overflow
1 parent 62244ed commit 4d3e680

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/upipe-modules/upipe_s337_encaps.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ static bool upipe_s337_encaps_handle(struct upipe *upipe, struct uref *uref,
172172
ubuf_sound_write_int32_t(ubuf, 0, -1, &out_data, 1);
173173

174174
/* Pa, Pb, Pc, Pd */
175-
out_data[0] = (S337_PREAMBLE_A1 << 24) | (S337_PREAMBLE_A2 << 16);
176-
out_data[1] = (S337_PREAMBLE_B1 << 24) | (S337_PREAMBLE_B2 << 16);
175+
out_data[0] = ((uint32_t)S337_PREAMBLE_A1 << 24) | (S337_PREAMBLE_A2 << 16);
176+
out_data[1] = ((uint32_t)S337_PREAMBLE_B1 << 24) | (S337_PREAMBLE_B2 << 16);
177177
out_data[2] = (S337_TYPE_A52 << 16) | (S337_MODE_16 << 21) |
178178
(S337_TYPE_A52_REP_RATE_FLAG << 24);
179179
out_data[3] = ((block_size * 8) & 0xffff) << 16;
@@ -200,7 +200,7 @@ static bool upipe_s337_encaps_handle(struct upipe *upipe, struct uref *uref,
200200
}
201201

202202
for (int i = 0; i < size/2; i++)
203-
out_data[4 + offset/2 + i] = (buf[2*i + 0] << 24) | (buf[2*i + 1] << 16);
203+
out_data[4 + offset/2 + i] = ((uint32_t)(buf[2*i + 0]) << 24) | (buf[2*i + 1] << 16);
204204
if (size & 1)
205205
tmp = buf[size-1];
206206

0 commit comments

Comments
 (0)