Skip to content

Commit

Permalink
x264lib: fix incorrect memory operations in decompress_image()
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@932 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
Arthur Huillet committed Jun 18, 2012
1 parent b606094 commit c05c7c1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/xpra/x264/x264lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ int decompress_image(struct x264lib_ctx *ctx, uint8_t *in, int size, uint8_t *(*
{
int got_picture;
int len;
int i;
AVFrame picture;
AVPacket avpkt;

Expand All @@ -220,12 +221,14 @@ int decompress_image(struct x264lib_ctx *ctx, uint8_t *in, int size, uint8_t *(*
return 2;
}

memcpy(out, &picture.data, sizeof(picture.data));
*outsize = ctx->height * (picture.linesize[0] + picture.linesize[1] + picture.linesize[2]);
memcpy(outstride, &picture.linesize, sizeof(picture.linesize));
for (i = 0; i < 3; i++) {
(*out)[i] = picture.data[i];
*outsize += ctx->height * picture.linesize[i];
(*outstride)[i] = picture.linesize[i];
}

if (*outsize == 0) {
printf("Decoded image, size %d %d %d, ptr %p %p %p\n", (*outstride)[0] * ctx->height, (*outstride)[1]*ctx->height, (*outstride)[2]*ctx->height, picture.data[0], picture.data[1], picture.data[2]);
fprintf(stderr, "Decoded image, size %d %d %d, ptr %p %p %p\n", (*outstride)[0] * ctx->height, (*outstride)[1]*ctx->height, (*outstride)[2]*ctx->height, picture.data[0], picture.data[1], picture.data[2]);
return 3;
}

Expand Down

0 comments on commit c05c7c1

Please sign in to comment.