Skip to content

Commit 96047e0

Browse files
committed
fixed #1887
1 parent f5a038e commit 96047e0

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

Diff for: src/filters/dec_xvid.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static GF_Err xviddec_configure_pid(GF_Filter *filter, GF_FilterPid *pid, Bool i
181181
/*decode DSI*/
182182
e = gf_m4v_get_config(p->value.data.ptr, p->value.data.size, &dsi);
183183
if (e) return e;
184-
if (!dsi.width || !dsi.height) return GF_NON_COMPLIANT_BITSTREAM;
184+
if (!dsi.width || (dsi.width%2) || !dsi.height) return GF_NON_COMPLIANT_BITSTREAM;
185185

186186
memset(&par, 0, sizeof(par));
187187
par.width = dsi.width;

Diff for: src/filters/reframe_mpgvid.c

+20-10
Original file line numberDiff line numberDiff line change
@@ -805,12 +805,17 @@ GF_Err mpgviddmx_process(GF_Filter *filter)
805805
//not enough data, accumulate until we can parse the full header
806806
if (e==GF_EOS) {
807807
if (vosh_start<0) vosh_start = 0;
808-
if (ctx->hdr_store_alloc < ctx->hdr_store_size + pck_size - vosh_start) {
809-
ctx->hdr_store_alloc = (u32) (ctx->hdr_store_size + pck_size - vosh_start);
810-
ctx->hdr_store = gf_realloc(ctx->hdr_store, sizeof(char)*ctx->hdr_store_alloc);
808+
if (data == ctx->hdr_store) {
809+
memmove(ctx->hdr_store, start, remain);
810+
ctx->hdr_store_size = remain;
811+
} else {
812+
if (ctx->hdr_store_alloc < ctx->hdr_store_size + pck_size - vosh_start) {
813+
ctx->hdr_store_alloc = (u32) (ctx->hdr_store_size + pck_size - vosh_start);
814+
ctx->hdr_store = gf_realloc(ctx->hdr_store, sizeof(char)*ctx->hdr_store_alloc);
815+
}
816+
memcpy(ctx->hdr_store + ctx->hdr_store_size, data + vosh_start, (size_t) (pck_size - vosh_start) );
817+
ctx->hdr_store_size += pck_size - (u32) vosh_start;
811818
}
812-
memcpy(ctx->hdr_store + ctx->hdr_store_size, data + vosh_start, (size_t) (pck_size - vosh_start) );
813-
ctx->hdr_store_size += pck_size - (u32) vosh_start;
814819
gf_filter_pid_drop_packet(ctx->ipid);
815820
return GF_OK;
816821
} else if (e != GF_OK) {
@@ -844,12 +849,17 @@ GF_Err mpgviddmx_process(GF_Filter *filter)
844849
//not enough data, accumulate until we can parse the full header
845850
if (e==GF_EOS) {
846851
if (vosh_start<0) vosh_start = 0;
847-
if (ctx->hdr_store_alloc < ctx->hdr_store_size + pck_size - vosh_start) {
848-
ctx->hdr_store_alloc = (u32) (ctx->hdr_store_size + pck_size - (u32) vosh_start);
849-
ctx->hdr_store = gf_realloc(ctx->hdr_store, sizeof(char)*ctx->hdr_store_alloc);
852+
if (data == ctx->hdr_store) {
853+
memmove(ctx->hdr_store, start, remain);
854+
ctx->hdr_store_size = remain;
855+
} else {
856+
if (ctx->hdr_store_alloc < ctx->hdr_store_size + pck_size - vosh_start) {
857+
ctx->hdr_store_alloc = (u32) (ctx->hdr_store_size + pck_size - (u32) vosh_start);
858+
ctx->hdr_store = gf_realloc(ctx->hdr_store, sizeof(char)*ctx->hdr_store_alloc);
859+
}
860+
memcpy(ctx->hdr_store + ctx->hdr_store_size, data + vosh_start, (size_t) (pck_size - vosh_start) );
861+
ctx->hdr_store_size += pck_size - (u32) vosh_start;
850862
}
851-
memcpy(ctx->hdr_store + ctx->hdr_store_size, data + vosh_start, (size_t) (pck_size - vosh_start) );
852-
ctx->hdr_store_size += pck_size - (u32) vosh_start;
853863
gf_filter_pid_drop_packet(ctx->ipid);
854864
return GF_OK;
855865
} else if (e != GF_OK) {

0 commit comments

Comments
 (0)