Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
25551d44
Commit
25551d44
authored
Nov 22, 2010
by
Hisham Muhammad
Browse files
Fix off-by-one in Vector (the probable cause for many user-reported crashes?)
parent
9604e021
Changes
1
Hide whitespace changes
Inline
Side-by-side
Vector.c
View file @
25551d44
...
@@ -133,8 +133,8 @@ void Vector_insert(Vector* this, int idx, void* data_) {
...
@@ -133,8 +133,8 @@ void Vector_insert(Vector* this, int idx, void* data_) {
Vector_checkArraySize
(
this
);
Vector_checkArraySize
(
this
);
assert
(
this
->
array
[
this
->
items
]
==
NULL
);
assert
(
this
->
array
[
this
->
items
]
==
NULL
);
for
(
int
i
=
this
->
items
;
i
>
=
idx
;
i
--
)
{
for
(
int
i
=
this
->
items
;
i
>
idx
;
i
--
)
{
this
->
array
[
i
+
1
]
=
this
->
array
[
i
];
this
->
array
[
i
]
=
this
->
array
[
i
-
1
];
}
}
this
->
array
[
idx
]
=
data
;
this
->
array
[
idx
]
=
data
;
this
->
items
++
;
this
->
items
++
;
...
...
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