Summary: fix, add missing break statements in mapfam permutation code
authorSebastian Freundt <hroptatyr@fresse.org>
Sat, 21 Jan 2012 00:03:13 +0000 (00:03 +0000)
committerSebastian Freundt <hroptatyr@fresse.org>
Sat, 21 Jan 2012 00:03:13 +0000 (00:03 +0000)
Keywords: fix bug 135

This changeset fixes a potential stack bashing in the mapfam permutation
code by inserting proper break statements where they belong.  This could
be one of the reasons of bug #135 and it's yet to be shown that it fixes
anything (other than pleasing coverity).

* src/map.c (__perm_nseq): no switch fallthrough, insert breaks

Signed-off-by: Sebastian Freundt <hroptatyr@fresse.org>
src/map.c

index a771287..db4f1c7 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -3214,6 +3214,7 @@ __perm_nseq(Lisp_Object seqs[], size_t nseqs, Lisp_Object fun, size_t arity,
                                __advance_multi_index_2(idx, 2, nseqsz);
                        }
                }
+               break;
 
        case 3:
                if (LIKELY(!NILP(fun) && gf == NULL)) {
@@ -3248,7 +3249,7 @@ __perm_nseq(Lisp_Object seqs[], size_t nseqs, Lisp_Object fun, size_t arity,
                                __advance_multi_index_2(idx, 3, nseqsz);
                        }
                }
-
+               break;
 
        default:
                if (LIKELY(!NILP(fun) && gf == NULL)) {
@@ -3293,6 +3294,7 @@ __perm_nseq(Lisp_Object seqs[], size_t nseqs, Lisp_Object fun, size_t arity,
                                __advance_multi_index_2(idx, nseqs, nseqsz);
                        }
                }
+               break;
        }
        UNGCPRO;