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
929fdbbf
Commit
929fdbbf
authored
Jan 18, 2023
by
Gabriel Ivăncescu
Committed by
Alexandre Julliard
Jan 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notepad: Fix uninitialized upper 64-bits of `pos` in DoFind.
And get rid of the hacky casts. Signed-off-by:
Gabriel Ivăncescu
<
gabrielopcode@gmail.com
>
parent
8ddf8daa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
main.c
programs/notepad/main.c
+8
-11
No files found.
programs/notepad/main.c
View file @
929fdbbf
...
...
@@ -441,10 +441,10 @@ static LPWSTR NOTEPAD_StrRStr(LPWSTR pszSource, LPWSTR pszLast, LPWSTR pszSrch)
*/
void
NOTEPAD_DoFind
(
FINDREPLACEW
*
fr
)
{
LPWSTR
content
;
LPWSTR
content
,
found
;
int
len
=
lstrlenW
(
fr
->
lpstrFindWhat
);
int
fileLen
;
SIZE_T
pos
;
DWORD
pos
;
fileLen
=
GetWindowTextLengthW
(
Globals
.
hEdit
)
+
1
;
content
=
HeapAlloc
(
GetProcessHeap
(),
0
,
fileLen
*
sizeof
(
WCHAR
));
...
...
@@ -455,27 +455,24 @@ void NOTEPAD_DoFind(FINDREPLACEW *fr)
switch
(
fr
->
Flags
&
(
FR_DOWN
|
FR_MATCHCASE
))
{
case
0
:
pos
=
StrRStrIW
(
content
,
content
+
pos
-
len
,
fr
->
lpstrFindWhat
)
-
content
;
if
(
pos
==
-
(
SIZE_T
)
content
)
pos
=
~
(
SIZE_T
)
0
;
found
=
StrRStrIW
(
content
,
content
+
pos
-
len
,
fr
->
lpstrFindWhat
);
break
;
case
FR_DOWN
:
pos
=
StrStrIW
(
content
+
pos
,
fr
->
lpstrFindWhat
)
-
content
;
if
(
pos
==
-
(
SIZE_T
)
content
)
pos
=
~
(
SIZE_T
)
0
;
found
=
StrStrIW
(
content
+
pos
,
fr
->
lpstrFindWhat
);
break
;
case
FR_MATCHCASE
:
pos
=
NOTEPAD_StrRStr
(
content
,
content
+
pos
-
len
,
fr
->
lpstrFindWhat
)
-
content
;
if
(
pos
==
-
(
SIZE_T
)
content
)
pos
=
~
(
SIZE_T
)
0
;
found
=
NOTEPAD_StrRStr
(
content
,
content
+
pos
-
len
,
fr
->
lpstrFindWhat
);
break
;
case
FR_DOWN
|
FR_MATCHCASE
:
pos
=
StrStrW
(
content
+
pos
,
fr
->
lpstrFindWhat
)
-
content
;
if
(
pos
==
-
(
SIZE_T
)
content
)
pos
=
~
(
SIZE_T
)
0
;
found
=
StrStrW
(
content
+
pos
,
fr
->
lpstrFindWhat
);
break
;
default:
/* shouldn't happen */
return
;
}
pos
=
found
-
content
;
HeapFree
(
GetProcessHeap
(),
0
,
content
);
if
(
pos
==
~
(
SIZE_T
)
0
)
if
(
!
found
)
{
DIALOG_StringMsgBox
(
Globals
.
hFindReplaceDlg
,
STRING_NOTFOUND
,
fr
->
lpstrFindWhat
,
MB_ICONINFORMATION
|
MB_OK
);
...
...
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