]> git.pld-linux.org Git - packages/Yap.git/blame - Off-by-one-error-when-initializing-yap_flags.patch
- build only on x86 and x86_64
[packages/Yap.git] / Off-by-one-error-when-initializing-yap_flags.patch
CommitLineData
9c30d598
JR
1From fa8f0f7b2d107770ae4d37bc77c902eafc59c86c Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
3Date: Mon, 7 Jan 2013 17:31:08 +0100
4Subject: [PATCH] Off-by-one error when initializing yap_flags
5
6The yap_flags_field of all_heap_codes structure is of type
7Int[LAST_FLAG], thus the loop should iterate from 0 to LAST_FLAG - 1.
8---
9 C/init.c | 2 +-
10 C/stdpreds.c | 2 +-
11 2 files changed, 2 insertions(+), 2 deletions(-)
12
13diff --git a/C/init.c b/C/init.c
14index dda09cc..8f01864 100755
15--- a/C/init.c
16+++ b/C/init.c
17@@ -1348,7 +1348,7 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
18 Yap_InitTime ();
19 /* InitAbsmi must be done before InitCodes */
20 /* This must be done before initialising predicates */
21- for (i = 0; i <= LAST_FLAG; i++) {
22+ for (i = 0; i < LAST_FLAG; i++) {
23 yap_flags[i] = 0;
24 }
25 #ifdef MPW
26diff --git a/C/stdpreds.c b/C/stdpreds.c
27index a4c0e86..8a4183f 100755
28--- a/C/stdpreds.c
29+++ b/C/stdpreds.c
30@@ -3637,7 +3637,7 @@ p_access_yap_flags(void)
31 return(FALSE);
32 }
33 flag = IntOfTerm(tflag);
34- if (flag < 0 || flag > NUMBER_OF_YAP_FLAGS) {
35+ if (flag < 0 || flag >= NUMBER_OF_YAP_FLAGS) {
36 return(FALSE);
37 }
38 #ifdef TABLING
39--
401.7.11.7
41
This page took 0.048909 seconds and 4 git commands to generate.