Merge ~liushuyu-011/ubuntu/+source/aevol:ubuntu/devel into ubuntu/+source/aevol:ubuntu/devel

Proposed by Zixing Liu
Status: Needs review
Proposed branch: ~liushuyu-011/ubuntu/+source/aevol:ubuntu/devel
Merge into: ubuntu/+source/aevol:ubuntu/devel
Diff against target: 55 lines (+34/-0)
3 files modified
debian/changelog (+6/-0)
debian/patches/nullptr-fix.patch (+27/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Nick Rosbrook (community) Needs Information
Review via email: mp+468013@code.launchpad.net

Description of the change

This MP fixes the null pointer dereference in the parsing/transcribing logic.

It was caught by a test.

To post a comment you must log in.
Revision history for this message
Nick Rosbrook (enr0n) wrote :

What test caught this? Where is the bug detailing all of this? Is there a particular reason you have chosen not to forward the patch?

review: Needs Information

Unmerged commits

0ef6a40... by Zixing Liu

d/p/nullptr-fix.patch: add a patch to fix NULL pointer handling

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index f982c5b..5812f93 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,9 @@
6+aevol (5.0+ds-3ubuntu1) oracular; urgency=medium
7+
8+ * d/p/nullptr-fix.patch: add a patch to fix NULL pointer handling.
9+
10+ -- Zixing Liu <zixing.liu@canonical.com> Thu, 20 Jun 2024 14:29:17 -0600
11+
12 aevol (5.0+ds-3build1) noble; urgency=medium
13
14 * No-change rebuild for boost defaults change.
15diff --git a/debian/patches/nullptr-fix.patch b/debian/patches/nullptr-fix.patch
16new file mode 100644
17index 0000000..6e6b39b
18--- /dev/null
19+++ b/debian/patches/nullptr-fix.patch
20@@ -0,0 +1,27 @@
21+Description: Fix NULL pointer handling in stats parsing
22+Author: Zixing Liu <zixing.liu@canonical.com>
23+Forwarded: no
24+Last-Update: 2024-06-20
25+---
26+diff --git a/src/libaevol/Stats.cpp b/src/libaevol/Stats.cpp
27+index 3be286d..0212d77 100644
28+--- a/src/libaevol/Stats.cpp
29++++ b/src/libaevol/Stats.cpp
30+@@ -807,9 +807,14 @@ void Stats::Propagate(const std::string& destdir, int64_t propagated_timestep) {
31+
32+ // Write the line for propagated_timestep
33+ // after replacing the timestep with 0
34+- char new_line[strlen(line)+1];
35+- sprintf(new_line, "0%s", strchr(line, ' '));
36+- fputs(new_line, new_file);
37++ char new_line[strlen(line)+1] = {0};
38++ char* contents = strchr(line, ' ');
39++ if (contents) {
40++ sprintf(new_line, "0%s", strchr(line, ' '));
41++ fputs(new_line, new_file);
42++ } else {
43++ fputs(line, new_file);
44++ }
45+
46+ fclose(old_file);
47+ fclose(new_file);
48diff --git a/debian/patches/series b/debian/patches/series
49index 64024c9..d576e49 100644
50--- a/debian/patches/series
51+++ b/debian/patches/series
52@@ -1,2 +1,3 @@
53 automake.patch
54 groff-message.patch
55+nullptr-fix.patch

Subscribers

People subscribed via source and target branches

to all changes: