Skip to contentSkip to conversation

Fix for psplash segmentation fault

PATCH Applied Aws Ismail 2 participants 4 messages Jul 6, 2012 – Jul 16, 2012

lore
Share & tools
lore

Aws Ismail

author
#0 lore raw

PATCH 1/1 Fix for psplash segmentation fault

Fix segmentation fault when passing -a without angel value.

When psplash -a is called instead of psplash -a<angle value> it will segmentation fault calling out of bound argv[].

git://git.yoctoproject.org/psplash

-----------------------------------------------------------------

psplash.c +1 -1
index 0158628..09cf0d0 100644
@@ -219,7 +219,7 @@ main (int argc, char** argv)
 
       if (!strcmp(argv[i],"-a") || !strcmp(argv[i],"--angle"))
         {
-         if (++i > argc) goto fail;
+         if (++i >= argc) goto fail;
          angle = atoi(argv[i]);
          continue;
        }
author
#1 lore raw

s/angel/angle :)

Aws\

Quoted 29 lines · Aws Ismail

Fix segmentation fault when passing -a without angel value.

When psplash -a is called instead of psplash -a<angle value> it will segmentation fault calling out of bound argv[].

git://git.yoctoproject.org/psplash

-----------------------------------------------------------------

psplash.c +1 -1
index 0158628..09cf0d0 100644
@@ -219,7 +219,7 @@ main (int argc, char** argv)
 
       if (!strcmp(argv[i],"-a") || !strcmp(argv[i],"--angle"))
         {
-         if (++i > argc) goto fail;
+         if (++i >= argc) goto fail;
          angle = atoi(argv[i]);
          continue;
        }

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

Signature · 3 lines
-----------
Aws Ismail
-----------
author
#2 lore raw
In reply to Aws Ismail

Hi all,

This is a follow-up on the fix I sent recently for psplash. I'd appreciate any comments.

Thanks

Aws Ismail

====================================================================
Fix psplash segmentation fault

This fixes the segmentation fault when calling:
psplash -a

The -a option requires a rotation angle to be given and if it is missing then the user is shown the correct usage.

From: git://git.yoctoproject.org/psplash

--------------------------------------------------------------------

psplash.c +1 -1
index 0158628..09cf0d0 100644
@@ -219,7 +219,7 @@ main (int argc, char** argv)
 
       if (!strcmp(argv[i],"-a") || !strcmp(argv[i],"--angle"))
         {
-         if (++i > argc) goto fail;
+         if (++i >= argc) goto fail;
          angle = atoi(argv[i]);
          continue;
        }
Quoted 29 lines · Aws Ismail

Fix segmentation fault when passing -a without angle value.

When psplash -a is called instead of psplash -a<angle value> it will segmentation fault calling out of bound argv[].

git://git.yoctoproject.org/psplash

-----------------------------------------------------------------

psplash.c +1 -1
index 0158628..09cf0d0 100644
@@ -219,7 +219,7 @@ main (int argc, char** argv)
 
       if (!strcmp(argv[i],"-a") || !strcmp(argv[i],"--angle"))
         {
-         if (++i > argc) goto fail;
+         if (++i >= argc) goto fail;
          angle = atoi(argv[i]);
          continue;
        }

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

Applied
#3 lore raw
In reply to Aws Ismail
Quoted 17 lines · Aws Ismail

Fix segmentation fault when passing -a without angel value.

When psplash -a is called instead of psplash -a<angle value> it will segmentation fault calling out of bound argv[].

git://git.yoctoproject.org/psplash

-----------------------------------------------------------------

psplash.c +0 -0
index 0158628..09cf0d0 100644

psplash.c main (int argc, char** argv) · line 225

Quoted 8 lines
psplash.c +1 -1
@@ -219,7 +219,7 @@ main (int argc, char** argv)
 
        if (!strcmp(argv[i],"-a") || !strcmp(argv[i],"--angle"))
          {
-         if (++i > argc) goto fail;
+         if (++i >= argc) goto fail;
           angle = atoi(argv[i]);
           continue;
         }

Merged into psplash upstream, if you would like to send a patch to Openembedded-Core updating the psplash recipe that would be welcome also.

Thanks
Sau!

Quoted 6 lines

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto