• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

GothenburgBitFactory / taskwarrior / 11489652313

23 Oct 2024 11:18PM UTC coverage: 84.827% (-0.007%) from 84.834%
11489652313

push

github

web-flow
Limit the allowed epoch timestamps (#3651)

The code for parsing epoch timestamps when displaying tasks only
supports values between year 1980 and 9999. Previous to this change, it
was possible to set e.g., the due timestamp to a value outside of these
limits, which would make it impossible to later on show the task.

With this change, we only allow setting values within the same limits
used by the code for displaying tasks.

3 of 4 new or added lines in 1 file covered. (75.0%)

1 existing line in 1 file now uncovered.

19025 of 22428 relevant lines covered (84.83%)

23055.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

44.0
/src/main.cpp
1
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright 2006 - 2021, Tomas Babej, Paul Beckingham, Federico Hernandez.
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included
13
// in all copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
// SOFTWARE.
22
//
23
// https://www.opensource.org/licenses/mit-license.php
24
//
25
////////////////////////////////////////////////////////////////////////////////
26

27
#include <cmake.h>
28
// cmake.h include header must come first
29

30
#include <Context.h>
31
#include <rust/cxx.h>
32
#include <signal.h>
33

34
#include <cstring>
35
#include <iostream>
36
#include <new>
37
#include <regex>
38

39
////////////////////////////////////////////////////////////////////////////////
40
int main(int argc, const char** argv) {
4,499✔
41
  int status{0};
4,499✔
42

43
  // Ignore SIGPIPE from writes to network sockets after the remote end has hung
44
  // up. Rust code expects this, and the Rust runtime ignores this signal at startup.
45
  signal(SIGPIPE, SIG_IGN);
4,499✔
46

47
  Context globalContext;
4,499✔
48
  Context::setContext(&globalContext);
4,499✔
49

50
  // Lightweight version checking that doesn't require initialization or any I/O.
51
  if (argc == 2 && !strcmp(argv[1], "--version")) {
4,499✔
52
    std::cout << VERSION << "\n";
1✔
53
  } else {
54
    try {
55
      status = Context::getContext().initialize(argc, argv);
4,498✔
56
      if (status == 0) status = Context::getContext().run();
4,498✔
57
    }
58

59
    catch (const std::string& error) {
×
60
      std::cerr << error << "\n";
×
61
      status = -1;
×
62
    }
63

64
    catch (rust::Error& err) {
×
65
      std::cerr << err.what() << "\n";
×
66
      status = -1;
×
67
    }
68

69
    catch (std::bad_alloc& error) {
×
70
      std::cerr << "Error: Memory allocation failed: " << error.what() << "\n";
×
71
      status = -3;
×
72
    }
73

74
    catch (const std::regex_error& e) {
×
75
      std::cout << "regex_error caught: " << e.what() << '\n';
×
76
    }
77

78
    catch (...) {
×
79
      std::cerr << "Unknown error. Please report.\n";
×
80
      status = -2;
×
81
    }
82
  }
83

84
  return status;
4,499✔
85
}
4,499✔
86

87
////////////////////////////////////////////////////////////////////////////////
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc