Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1bf7bee3
Commit
1bf7bee3
authored
Jan 21, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1265 from arrbee/parse-commit-time-as-uint64
Parse commit time as uint64_t to avoid overflow
parents
d47c6aab
965e4e2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
src/signature.c
+2
-2
tests-clar/commit/parse.c
+8
-0
No files found.
src/signature.c
View file @
1bf7bee3
...
@@ -241,15 +241,15 @@ static const char *scan_for_previous_token(const char *buffer, const char *left_
...
@@ -241,15 +241,15 @@ static const char *scan_for_previous_token(const char *buffer, const char *left_
static
int
parse_time
(
git_time_t
*
time_out
,
const
char
*
buffer
)
static
int
parse_time
(
git_time_t
*
time_out
,
const
char
*
buffer
)
{
{
int
time
;
int
error
;
int
error
;
int64_t
time
;
if
(
*
buffer
==
'+'
||
*
buffer
==
'-'
)
{
if
(
*
buffer
==
'+'
||
*
buffer
==
'-'
)
{
giterr_set
(
GITERR_INVALID
,
"Failed while parsing time. '%s' actually looks like a timezone offset."
,
buffer
);
giterr_set
(
GITERR_INVALID
,
"Failed while parsing time. '%s' actually looks like a timezone offset."
,
buffer
);
return
-
1
;
return
-
1
;
}
}
error
=
git__strtol
32
(
&
time
,
buffer
,
&
buffer
,
10
);
error
=
git__strtol
64
(
&
time
,
buffer
,
&
buffer
,
10
);
if
(
!
error
)
if
(
!
error
)
*
time_out
=
(
git_time_t
)
time
;
*
time_out
=
(
git_time_t
)
time
;
...
...
tests-clar/commit/parse.c
View file @
1bf7bee3
...
@@ -121,6 +121,14 @@ passing_signature_test_case passing_signature_cases[] = {
...
@@ -121,6 +121,14 @@ passing_signature_test_case passing_signature_cases[] = {
{
"author A U Thor <author@example.com> and others 1234567890 -0700
\n
"
,
"author "
,
"A U Thor"
,
"author@example.com"
,
1234567890
,
-
420
},
{
"author A U Thor <author@example.com> and others 1234567890 -0700
\n
"
,
"author "
,
"A U Thor"
,
"author@example.com"
,
1234567890
,
-
420
},
{
"author A U Thor <author@example.com> and others 1234567890
\n
"
,
"author "
,
"A U Thor"
,
"author@example.com"
,
1234567890
,
0
},
{
"author A U Thor <author@example.com> and others 1234567890
\n
"
,
"author "
,
"A U Thor"
,
"author@example.com"
,
1234567890
,
0
},
{
"author A U Thor> <author@example.com> and others 1234567890
\n
"
,
"author "
,
"A U Thor>"
,
"author@example.com"
,
1234567890
,
0
},
{
"author A U Thor> <author@example.com> and others 1234567890
\n
"
,
"author "
,
"A U Thor>"
,
"author@example.com"
,
1234567890
,
0
},
/* a variety of dates */
{
"author Vicent Marti <tanoku@gmail.com> 0
\n
"
,
"author "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
0
,
0
},
{
"author Vicent Marti <tanoku@gmail.com> 1234567890
\n
"
,
"author "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
1234567890
,
0
},
{
"author Vicent Marti <tanoku@gmail.com> 2147483647
\n
"
,
"author "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
0x7fffffff
,
0
},
{
"author Vicent Marti <tanoku@gmail.com> 4294967295
\n
"
,
"author "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
0xffffffff
,
0
},
{
"author Vicent Marti <tanoku@gmail.com> 4294967296
\n
"
,
"author "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
4294967296
,
0
},
{
"author Vicent Marti <tanoku@gmail.com> 8589934592
\n
"
,
"author "
,
"Vicent Marti"
,
"tanoku@gmail.com"
,
8589934592
,
0
},
{
NULL
,
NULL
,
NULL
,
NULL
,
0
,
0
}
{
NULL
,
NULL
,
NULL
,
NULL
,
0
,
0
}
};
};
...
...
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