- printf ("tab_joint_text(): bad cell "
- "(%d+%d=%d,%d+%d=%d)-(%d+%d=%d,%d+%d=%d) in table size (%d,%d)\n",
- x1, table->col_ofs, x1 + table->col_ofs,
- y1, table->row_ofs, y1 + table->row_ofs,
- x2, table->col_ofs, x2 + table->col_ofs,
- y2, table->row_ofs, y2 + table->row_ofs,
- tab_nc (table), tab_nr (table));
- return NULL;
+ if (x1 + table->col_ofs < 0 || x1 + table->col_ofs >= tab_nc (table)
+ || y1 + table->row_ofs < 0 || y1 + table->row_ofs >= tab_nr (table)
+ || x2 < x1 || x2 + table->col_ofs >= tab_nc (table)
+ || y2 < y1 || y2 + table->row_ofs >= tab_nr (table))
+ {
+ printf ("tab_joint_text(): bad cell "
+ "(%d+%d=%d,%d+%d=%d)-(%d+%d=%d,%d+%d=%d) in table size (%d,%d)\n",
+ x1, table->col_ofs, x1 + table->col_ofs,
+ y1, table->row_ofs, y1 + table->row_ofs,
+ x2, table->col_ofs, x2 + table->col_ofs,
+ y2, table->row_ofs, y2 + table->row_ofs,
+ tab_nc (table), tab_nr (table));
+ return NULL;
+ }