[PATCH] 6788196: Array bounds checks in io_util.c rely on undefined behaviour
Andrew Haley
aph at redhat.com
Tue Jan 6 16:44:28 UTC 2009
Gary Benson wrote:
> Hi Martin,
>
> I like your method of avoiding the overflow, it's a nice idea.
> I've attached an updated version of my original patch, with that,
> and with an expanded comment too, to make sure the fix doesn't
> get reverted later on in the interests of readability or whatever.
>
> Can I ask that you file a seperate bug for your other changes?
> They're not specifically related to 6788196, and I feel it
> confuses the issue somewhat having a bunch of unrelated changes
> in the patch.
> Martin Buchholz wrote:
There are some indentation SNAFUs here. Maybe due to tab width set to
4?
>> @@ -196,19 +203,19 @@ throwFileNotFoundException(JNIEnv *env,
>> throwFileNotFoundException(JNIEnv *env, jstring path)
>> {
>> char buf[256];
>> - int n;
>> + jint n;
>> jobject x;
>> jstring why = NULL;
>>
>> n = JVM_GetLastErrorString(buf, sizeof(buf));
>> if (n > 0) {
>> - why = JNU_NewStringPlatform(env, buf);
>> + why = JNU_NewStringPlatform(env, buf);
^ here
>> }
>> x = JNU_NewObjectByName(env,
>> "java/io/FileNotFoundException",
>> "(Ljava/lang/String;Ljava/lang/String;)V",
>> path, why);
>> if (x != NULL) {
>> - (*env)->Throw(env, x);
>> + (*env)->Throw(env, x);
^ here
>> }
>> }
More information about the core-libs-dev
mailing list