Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#8969 closed defect (needs_more_info)

swscale crash

Reported by: Darko Jurić Owned by:
Priority: important Component: swscale
Version: git-master Keywords: crash
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Program is crashing when using swscale (yuv420p->bgr24) on an target image with alignment 1. The underlying OS is Ubuntu 18.04LTS Server edition. The code is working fine on Windows 10, Ubuntu18.04LTS Desktop, OSX.

#include <libswscale/swscale.h>
#include <libavutil/imgutils.h>

typedef unsigned char byte;

void yuv420ToBgr24(uint8_t* srcData[4], int srcStride[4], uint8_t* tgtData[4], int tgtStride[4], int w, int h)
{
	struct SwsContext* context = sws_getContext(w, h, AV_PIX_FMT_YUV420P,
		                                        w, h, AV_PIX_FMT_BGR24, 
		                                        SWS_FAST_BILINEAR | SWS_BITEXACT, NULL, NULL, NULL);
	{
		sws_scale(context,
			      srcData, srcStride, 0, h,
			      tgtData, tgtStride);
	}
	sws_freeContext(context);
}

void main()
{
	int w = 854; int h = 400;

	uint8_t* yuvData[4]; int yuvStride[4];
	av_image_alloc(yuvData, yuvStride, w, h, AV_PIX_FMT_YUV420P, 16);

	uint8_t* bgrData[4]; int bgrStride[4];
	av_image_alloc(bgrData, bgrStride, w, h, AV_PIX_FMT_BGR24, 1); //if align is 1 then segfault is obtained

	yuv420ToBgr24(yuvData, yuvStride, bgrData, bgrStride, w, h);
	printf("done\n");
}

Change History (3)

comment:1 by Carl Eugen Hoyos, 2 years ago

Component: undeterminedswscale
Keywords: crash added
Reproduced by developer: unset

comment:2 by Darko Jurić, 2 years ago

Resolution: fixed
Status: newclosed

comment:3 by Carl Eugen Hoyos, 2 years ago

Resolution: fixedneeds_more_info
Note: See TracTickets for help on using tickets.