Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
34db84e1
Commit
34db84e1
authored
Aug 27, 2005
by
Jason Edmeades
Committed by
Alexandre Julliard
Aug 27, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Listbox delete string handling should validate the range of the
index. Added some tests.
parent
52a63149
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
listbox.c
dlls/user/listbox.c
+2
-3
listbox.c
dlls/user/tests/listbox.c
+11
-0
No files found.
dlls/user/listbox.c
View file @
34db84e1
...
...
@@ -1662,8 +1662,7 @@ static LRESULT LISTBOX_RemoveItem( LB_DESCR *descr, INT index )
LB_ITEMDATA
*
item
;
INT
max_items
;
if
((
index
==
-
1
)
&&
(
descr
->
nb_items
>
0
))
index
=
descr
->
nb_items
-
1
;
else
if
((
index
<
0
)
||
(
index
>=
descr
->
nb_items
))
return
LB_ERR
;
if
((
index
<
0
)
||
(
index
>=
descr
->
nb_items
))
return
LB_ERR
;
/* We need to invalidate the original rect instead of the updated one. */
LISTBOX_InvalidateItems
(
descr
,
index
);
...
...
@@ -1760,7 +1759,7 @@ static LRESULT LISTBOX_SetCount( LB_DESCR *descr, INT count )
else
if
(
count
<
descr
->
nb_items
)
{
while
(
count
<
descr
->
nb_items
)
if
((
ret
=
LISTBOX_RemoveItem
(
descr
,
-
1
))
<
0
)
if
((
ret
=
LISTBOX_RemoveItem
(
descr
,
(
descr
->
nb_items
-
1
)
))
<
0
)
return
ret
;
}
return
LB_OKAY
;
...
...
dlls/user/tests/listbox.c
View file @
34db84e1
...
...
@@ -139,6 +139,7 @@ check (const struct listbox_test test)
HWND
hLB
=
create_listbox
(
test
.
prop
.
add_style
,
0
);
RECT
second_item
;
int
i
;
int
res
;
listbox_query
(
hLB
,
&
answer
);
listbox_ok
(
test
,
init
,
answer
);
...
...
@@ -179,6 +180,16 @@ check (const struct listbox_test test)
HeapFree
(
GetProcessHeap
(),
0
,
txt
);
}
/* Confirm the count of items, and that an invalid delete does not remove anything */
res
=
SendMessage
(
hLB
,
LB_GETCOUNT
,
0
,
0
);
ok
((
res
==
4
),
"Expected 4 items, got %d
\n
"
,
res
);
res
=
SendMessage
(
hLB
,
LB_DELETESTRING
,
-
1
,
0
);
ok
((
res
==
LB_ERR
),
"Expected LB_ERR items, got %d
\n
"
,
res
);
res
=
SendMessage
(
hLB
,
LB_DELETESTRING
,
4
,
0
);
ok
((
res
==
LB_ERR
),
"Expected LB_ERR items, got %d
\n
"
,
res
);
res
=
SendMessage
(
hLB
,
LB_GETCOUNT
,
0
,
0
);
ok
((
res
==
4
),
"Expected 4 items, got %d
\n
"
,
res
);
WAIT
;
DestroyWindow
(
hLB
);
}
...
...
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