Package: dwb Version: 20120628hg-1 While compiling the package using our research compiler infrastructure we noticed the following undefined behaviour in src/scripts.c, function global_checksum:
GChecksumType type = G_CHECKSUM_SHA256;
if (argc > 1) {
type = JSValueToNumber(ctx, argv[1], exc);
if (type == NAN) {
ret = JSValueMakeNull(ctx);
goto error_out;
}
type = MIN(MAX(type, G_CHECKSUM_MD5), G_CHECKSUM_SHA256);
}
The line
type = JSValueToNumber(ctx, argv[1], exc);
implicitly converts a double to an enum value, the outcome of which is
undefined. The comparison of type to NAN is always false (the enum cannot
represent NAN), and only the final MIN/MAX line ensures at least some value in a
range is picked.
Best,
Michael
pgpefdfBJxTnH.pgp
Description: PGP signature

