Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d69a5630
Commit
d69a5630
authored
Mar 11, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up disk_pos_assert() to be more general.
parent
3f68b65e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
myisam/mi_open.c
myisam/mi_open.c
+13
-14
No files found.
myisam/mi_open.c
View file @
d69a5630
...
@@ -35,6 +35,14 @@ static void setup_key_functions(MI_KEYDEF *keyinfo);
...
@@ -35,6 +35,14 @@ static void setup_key_functions(MI_KEYDEF *keyinfo);
pos+=size;}
pos+=size;}
#define disk_pos_assert(pos, end_pos) \
if (pos > end_pos) \
{ \
my_errno=HA_ERR_CRASHED; \
goto err; \
}
/******************************************************************************
/******************************************************************************
** Return the shared struct if the table is already open.
** Return the shared struct if the table is already open.
** In MySQL the server will handle version issues.
** In MySQL the server will handle version issues.
...
@@ -270,28 +278,19 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
...
@@ -270,28 +278,19 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share
->
state
.
header
.
max_block_size
));
share
->
state
.
header
.
max_block_size
));
strmov
(
share
->
filename
,
name_buff
);
strmov
(
share
->
filename
,
name_buff
);
#define disk_pos_assert do \
{ \
if (disk_pos > end_pos) \
{ \
my_errno=HA_ERR_CRASHED; \
goto err; \
} \
} while(0)
share
->
blocksize
=
min
(
IO_SIZE
,
myisam_block_size
);
share
->
blocksize
=
min
(
IO_SIZE
,
myisam_block_size
);
{
{
MI_KEYSEG
*
pos
=
share
->
keyparts
;
MI_KEYSEG
*
pos
=
share
->
keyparts
;
for
(
i
=
0
;
i
<
keys
;
i
++
)
for
(
i
=
0
;
i
<
keys
;
i
++
)
{
{
disk_pos
=
mi_keydef_read
(
disk_pos
,
&
share
->
keyinfo
[
i
]);
disk_pos
=
mi_keydef_read
(
disk_pos
,
&
share
->
keyinfo
[
i
]);
disk_pos_assert
;
disk_pos_assert
(
disk_pos
+
share
->
keyinfo
[
i
].
keysegs
*
MI_KEYSEG_SIZE
,
end_pos
);
set_if_smaller
(
share
->
blocksize
,
share
->
keyinfo
[
i
].
block_length
);
set_if_smaller
(
share
->
blocksize
,
share
->
keyinfo
[
i
].
block_length
);
share
->
keyinfo
[
i
].
seg
=
pos
;
share
->
keyinfo
[
i
].
seg
=
pos
;
for
(
j
=
0
;
j
<
share
->
keyinfo
[
i
].
keysegs
;
j
++
,
pos
++
)
for
(
j
=
0
;
j
<
share
->
keyinfo
[
i
].
keysegs
;
j
++
,
pos
++
)
{
{
disk_pos
=
mi_keyseg_read
(
disk_pos
,
pos
);
disk_pos
=
mi_keyseg_read
(
disk_pos
,
pos
);
disk_pos_assert
;
if
(
pos
->
type
==
HA_KEYTYPE_TEXT
||
pos
->
type
==
HA_KEYTYPE_VARTEXT
)
if
(
pos
->
type
==
HA_KEYTYPE_TEXT
||
pos
->
type
==
HA_KEYTYPE_VARTEXT
)
{
{
if
(
!
pos
->
language
)
if
(
!
pos
->
language
)
...
@@ -318,12 +317,12 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
...
@@ -318,12 +317,12 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
for
(
i
=
0
;
i
<
uniques
;
i
++
)
for
(
i
=
0
;
i
<
uniques
;
i
++
)
{
{
disk_pos
=
mi_uniquedef_read
(
disk_pos
,
&
share
->
uniqueinfo
[
i
]);
disk_pos
=
mi_uniquedef_read
(
disk_pos
,
&
share
->
uniqueinfo
[
i
]);
disk_pos_assert
;
disk_pos_assert
(
disk_pos
+
share
->
uniqueinfo
[
i
].
keysegs
*
MI_KEYSEG_SIZE
,
end_pos
);
share
->
uniqueinfo
[
i
].
seg
=
pos
;
share
->
uniqueinfo
[
i
].
seg
=
pos
;
for
(
j
=
0
;
j
<
share
->
uniqueinfo
[
i
].
keysegs
;
j
++
,
pos
++
)
for
(
j
=
0
;
j
<
share
->
uniqueinfo
[
i
].
keysegs
;
j
++
,
pos
++
)
{
{
disk_pos
=
mi_keyseg_read
(
disk_pos
,
pos
);
disk_pos
=
mi_keyseg_read
(
disk_pos
,
pos
);
disk_pos_assert
;
if
(
pos
->
type
==
HA_KEYTYPE_TEXT
||
pos
->
type
==
HA_KEYTYPE_VARTEXT
)
if
(
pos
->
type
==
HA_KEYTYPE_TEXT
||
pos
->
type
==
HA_KEYTYPE_VARTEXT
)
{
{
if
(
!
pos
->
language
)
if
(
!
pos
->
language
)
...
@@ -345,10 +344,10 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
...
@@ -345,10 +344,10 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
for
(
i
=
0
;
i
<
keys
;
i
++
)
for
(
i
=
0
;
i
<
keys
;
i
++
)
setup_key_functions
(
share
->
keyinfo
+
i
);
setup_key_functions
(
share
->
keyinfo
+
i
);
disk_pos_assert
(
disk_pos
+
share
->
base
.
fields
*
MI_COLUMNDEF_SIZE
,
end_pos
);
for
(
i
=
j
=
offset
=
0
;
i
<
share
->
base
.
fields
;
i
++
)
for
(
i
=
j
=
offset
=
0
;
i
<
share
->
base
.
fields
;
i
++
)
{
{
disk_pos
=
mi_recinfo_read
(
disk_pos
,
&
share
->
rec
[
i
]);
disk_pos
=
mi_recinfo_read
(
disk_pos
,
&
share
->
rec
[
i
]);
disk_pos_assert
;
share
->
rec
[
i
].
pack_type
=
0
;
share
->
rec
[
i
].
pack_type
=
0
;
share
->
rec
[
i
].
huff_tree
=
0
;
share
->
rec
[
i
].
huff_tree
=
0
;
share
->
rec
[
i
].
offset
=
offset
;
share
->
rec
[
i
].
offset
=
offset
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment