[swift-dev] quick, spot the UB in this code:

Dmitri Gribenko gribozavr at gmail.com
Wed Apr 6 23:51:27 CDT 2016


On Wed, Apr 6, 2016 at 9:16 PM, Drew Crawford via swift-dev
<swift-dev at swift.org> wrote:
> and it should crash
> deterministically if it gets non-terminated bytes, or

It can't, how would you check for this, only given a pointer?

> 2.  It should not require null-terminated bytes

This operation converts a C string to a Swift string, so (2) is a non-starter.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/


More information about the swift-dev mailing list