Pelles C forum

Pelles C => Bug reports => Topic started by: ghost on July 24, 2014, 04:41:33 AM

Title: Pellesc 7.00.355 (Win64) swprintf Access Violation
Post by: ghost on July 24, 2014, 04:41:33 AM
Building with machine setting X86 the following is producing an access violation:

(UNICODE,_UNICODE) is defined

char sz[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; // 68 chars = access violation , 67 chars = code runs fine
TCHAR szw[500] = _T("");
swprintf(szw,500,_T("%s"),sz);



With machine setting X64 the code runs without error. Version info is attached as image.
Title: Re: Pellesc 7.00.355 (Win64) swprintf Access Violation
Post by: Pelle on July 24, 2014, 10:48:39 AM
Bleh. It's a buffer limit calculated as bytes (128), not wide characters (64), leading to a buffer overrun. Will fix it for version 8.0.
Title: Re: Pellesc 7.00.355 (Win64) swprintf Access Violation
Post by: ghost on July 24, 2014, 01:29:39 PM
Thanks Pelle.