Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
b4fb6314
Commit
b4fb6314
authored
Jul 28, 2011
by
Paul Eggert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* emacs.c (main, sort_args): Check for size-calculation overflow.
parent
c9f8d652
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
src/ChangeLog
src/ChangeLog
+2
-0
src/emacs.c
src/emacs.c
+12
-3
No files found.
src/ChangeLog
View file @
b4fb6314
2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
* emacs.c (main, sort_args): Check for size-calculation overflow.
* editfns.c: Integer and memory overflow fixes.
(set_time_zone_rule): Don't assume environment length fits in int.
(message_length): Now ptrdiff_t, not int.
...
...
src/emacs.c
View file @
b4fb6314
...
...
@@ -1360,9 +1360,12 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
This requires inserting a new element into argv. */
if
(
displayname
!=
0
&&
skip_args
-
count_before
==
1
)
{
char
**
new
=
(
char
**
)
xmalloc
(
sizeof
(
char
*
)
*
(
argc
+
2
))
;
char
**
new
;
int
j
;
if
(
min
(
PTRDIFF_MAX
,
SIZE_MAX
)
/
sizeof
(
char
*
)
-
2
<
argc
)
memory_full
(
SIZE_MAX
);
new
=
(
char
**
)
xmalloc
(
sizeof
*
new
*
argc
+
sizeof
*
new
*
2
);
for
(
j
=
0
;
j
<
count_before
+
1
;
j
++
)
new
[
j
]
=
argv
[
j
];
new
[
count_before
+
1
]
=
(
char
*
)
"-d"
;
...
...
@@ -1838,13 +1841,19 @@ sort_args (int argc, char **argv)
0 for an option that takes no arguments,
1 for an option that takes one argument, etc.
-1 for an ordinary non-option argument. */
int
*
options
=
(
int
*
)
xmalloc
(
sizeof
(
int
)
*
argc
)
;
int
*
priority
=
(
int
*
)
xmalloc
(
sizeof
(
int
)
*
argc
)
;
int
*
options
;
int
*
priority
;
int
to
=
1
;
int
incoming_used
=
1
;
int
from
;
int
i
;
if
(
sizeof
(
char
*
)
<
sizeof
(
int
)
&&
min
(
PTRDIFF_MAX
,
SIZE_MAX
)
/
sizeof
(
int
)
<
argc
)
memory_full
(
SIZE_MAX
);
options
=
(
int
*
)
xmalloc
(
sizeof
(
int
)
*
argc
);
priority
=
(
int
*
)
xmalloc
(
sizeof
(
int
)
*
argc
);
/* Categorize all the options,
and figure out which argv elts are option arguments. */
for
(
from
=
1
;
from
<
argc
;
from
++
)
...
...
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