tags 430209 patch thanks Hi,
On Sat, Jun 23, 2007 at 01:32:41PM +0100, Domingo Alvarez Duarte wrote:
>When I invoke tcc with "-b" flag (bounds check) it reports an error on the
>line "s2[0] = 0;" and it's obvious that it's not memory problem.
>
>command line tcc -b -run program_bellow
>
>----------
>static char s1[20];
>static char s2[20];
>
>int main(void){
>s1[0] = 0;
>s2[0] = 0;
>return 0;
>}
>---------
Thomas Preud'homme made a patch some time ago to fix this, I am
posting it in his stead.
Cheers,
--
.''`. Aurélien GÉRÔME
: :' :
`. `'` Free Software Developer
`- Unix Sys & Net Admin
diff --git a/debian/changelog b/debian/changelog
index 7ca7e47..19efaf3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+tcc (0.9.24~cvs20070502-2) unstable; urgency=low
+
+ * Add a patch to fix a bound check error. (Closes: #430209)
+
+ -- Thomas Preud'homme <[EMAIL PROTECTED]> Mon, 25 Jun 2007 02:12:17 +0200
+
tcc (0.9.24~cvs20070502-1) unstable; urgency=low
[ Aurélien GÉRÔME ]
diff --git a/debian/patches/430209_fix_bound_check_error.diff
b/debian/patches/430209_fix_bound_check_error.diff
new file mode 100644
index 0000000..13a2724
--- /dev/null
+++ b/debian/patches/430209_fix_bound_check_error.diff
@@ -0,0 +1,30 @@
+diff -Nur tcc.orig/bcheck.c tcc/bcheck.c
+--- tcc.orig/bcheck.c 2007-06-25 01:01:11.000000000 +0200
++++ tcc/bcheck.c 2007-06-25 00:41:34.000000000 +0200
+@@ -120,7 +120,7 @@
+ while (e != NULL) {
+ addr = (unsigned long)p;
+ addr -= e->start;
+- if (addr <= e->size) {
++ if (addr < e->size) {
+ /* put region at the head */
+ tmp = e1->start;
+ e1->start = e->start;
+@@ -169,7 +169,7 @@
+ ((addr >> (BOUND_T3_BITS - BOUND_E_BITS)) &
+ ((BOUND_T2_SIZE - 1) << BOUND_E_BITS)));
+ addr -= e->start;
+- if (addr > e->size) {
++ if (addr >= e->size) {
+ e = __bound_find_region(e, p);
+ addr = (unsigned long)p - e->start;
+ }
+@@ -192,7 +192,7 @@
+ ((addr >> (BOUND_T3_BITS - BOUND_E_BITS)) & \
+ ((BOUND_T2_SIZE - 1) << BOUND_E_BITS))); \
+ addr -= e->start; \
+- if (addr > e->size) { \
++ if (addr >= e->size) { \
+ e = __bound_find_region(e, p); \
+ addr = (unsigned long)p - e->start; \
+ } \
diff --git a/debian/patches/series b/debian/patches/series
index 971141e..1c59304 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@ fhs.diff
372908_add_kfreebsd_arch.diff
352202_fix_int_overflow.diff
419203_fix_sizeof_parse_error.diff
+430209_fix_bound_check_error.diff
signature.asc
Description: Digital signature

