Commit graph

1584 commits

Author SHA1 Message Date
Enno Rehling
c090f8e1f4 CID 22441 Unchecked return value from library 2015-11-04 12:03:26 +01:00
Enno Rehling
d6cd1feb48 CID 22456: 'Constant' variable guards dead code
github issue #360
prayers sind ein feature, das nie fertig entwickelt wurde
2015-11-04 11:59:17 +01:00
Enno Rehling
978dd1400f CID 22465 Division or modulo by zero 2015-11-04 11:57:13 +01:00
Enno Rehling
a02b5f343e CID 22488 Dereference after null check 2015-11-04 11:55:04 +01:00
Enno Rehling
47f678d2a3 CID 22436 Ignoring number of bytes read, github issue #333 2015-11-04 11:51:19 +01:00
Enno Rehling
731dac3363 CID 22437 Unchecked return value from library
github issue #332
2015-11-04 11:45:13 +01:00
Enno Rehling
87a47e241c CID 22479 Dereference after null check
CID 22478 Dereference after null check
CID 22477 Dereference after null check
CID 22476 Dereference after null check
CID 22475 Dereference after null check
2015-11-04 11:23:57 +01:00
Enno Rehling
d4ff807c20 Merge pull request #364 from ennorehling/coverity-fixes
several smaller coverity fixes
2015-11-04 11:04:32 +01:00
Enno Rehling
024e4c45ca fix a bug introduced by f78fe842 (CID 22443) 2015-11-04 10:40:53 +01:00
Enno Rehling
c57668e6ee failing test for newly discovered storage problems 2015-11-04 09:48:51 +01:00
Enno Rehling
dedbd67d07 re-apply fix for CID 22551: dereference before null check (merge conflict) 2015-11-04 09:36:09 +01:00
Enno Rehling
0be8724093 CID 22475 Dereference after null check 2015-11-04 07:56:19 +01:00
Enno Rehling
04b5bc0c60 CID 22474 Evaluation order violation 2015-11-03 23:19:35 +01:00
Enno Rehling
7efda5f967 CID 22468 Division or modulo by zero 2015-11-03 23:18:56 +01:00
Enno Rehling
1f055b3175 CID 22466 Division or modulo by zero 2015-11-03 23:17:11 +01:00
Enno Rehling
103c480c91 CID 22465 Division or modulo by zero 2015-11-03 23:15:26 +01:00
Enno Rehling
1093a23d5a CID 22464 Division or modulo by zero 2015-11-03 23:14:06 +01:00
Enno Rehling
876e4122b1 CID 22463 Division or modulo by zero 2015-11-03 23:13:04 +01:00
Enno Rehling
fff40f048b CID 22462 Division or modulo by zero 2015-11-03 23:11:34 +01:00
Enno Rehling
e6973ff394 CID 22445 Unchecked return value 2015-11-03 23:05:44 +01:00
Enno Rehling
f78fe84216 CID 22443 Ignoring number of bytes read 2015-11-03 23:03:40 +01:00
Enno Rehling
870d42ccfe CID 22442 Unchecked return value from library 2015-11-03 23:01:09 +01:00
Enno Rehling
307c5ec85b CID 22435 Unchecked return value from library 2015-11-03 22:56:05 +01:00
Enno Rehling
0c5ef21c10 CID 22434 Ignoring number of bytes read
also potential missing  null-termination
2015-11-03 22:53:19 +01:00
Enno Rehling
154c2076a2 fixing bug 2149: projectile armor shall only protect against projectiles
https://bugs.eressea.de/view.php?id=2149
2015-11-03 19:12:40 +01:00
Enno Rehling
cfc31c6598 provide a failing test for issue 2149 2015-11-03 19:11:03 +01:00
Enno Rehling
f959f43f1e extensive tests for armor calculation 2015-11-03 18:59:09 +01:00
Enno Rehling
cc89e9c9da fix crash when rules do not define a unicorn item 2015-11-03 17:33:44 +01:00
Enno Rehling
15ff621cbb refactor: extract damage calculation from terminate
start writing tests (WIP)
2015-11-03 14:22:50 +01:00
Enno Rehling
91a6324a97 cleanup: functions do not need to be dereferenced with an & in C. 2015-11-03 13:30:34 +01:00
Enno Rehling
7e81b98fa4 Merge pull request #339 from TurnerSE/improvement/CID22481
Improvement/cid22481
2015-11-03 13:08:03 +01:00
Enno Rehling
4052f52472 Merge pull request #345 from TurnerSE/bug/#2145
Bug/#2145
2015-11-03 13:04:28 +01:00
Enno Rehling
ae28cbd7c3 Merge branch 'enhancement/airship_refactoring' of https://github.com/TurnerSE/server into TurnerSE-enhancement/airship_refactoring
Conflicts:
	src/spells/shipcurse.c
2015-11-03 13:02:42 +01:00
Philipp Dreher
5178bbd674 moved application of armor-penetration
halfed armor now includes the effect of natural armor, but not the
effect of magic armor
2015-11-03 00:05:55 +01:00
Philipp Dreher
bf42143b11 Revert "WIP new test for armor penetration"
This reverts commit dab8bdf7ef.
2015-11-03 00:01:10 +01:00
Philipp Dreher
0e83cc69d3 missed a spot... 2015-11-02 18:27:07 +01:00
Philipp Dreher
c2a8c32be0 forgot fwd-declaration of structs... 2015-11-02 18:08:35 +01:00
Philipp Dreher
07fd3dc970 formal correction 2015-11-02 18:06:19 +01:00
Philipp Dreher
30dce18697 small formal corrections 2015-11-02 17:58:14 +01:00
Philipp Dreher
96ccb046ab added test-suite for flyingship.c
some general testing of the spells functionality for future maintenance
purposes
2015-11-02 17:54:23 +01:00
Enno Rehling
63541dcc5d Merge pull request #338 from TurnerSE/improvement/test_skillpotion
Improvement/test skillpotion
2015-11-02 17:38:47 +01:00
Philipp Dreher
29173887b6 test_create_castorder can take spelllparameters now too 2015-11-02 17:09:16 +01:00
Enno Rehling
01078460bb Merge pull request #343 from ennorehling/feature/bug-2143-monsters-attack-buildings
bug 2143: monsters attack buildings
2015-11-02 16:40:32 +01:00
Philipp Dreher
0e8365c802 moved convenience function for convenience
the formerly static function test_create_castorder is now available for
general usage via tests.h/.c
2015-11-02 16:12:56 +01:00
Philipp Dreher
f550431118 small documentation correction 2015-11-02 15:59:29 +01:00
Enno Rehling
0b00bfecdf Merge pull request #342 from TurnerSE/bug/CID22449
Bug/cid22449
2015-11-02 15:55:44 +01:00
Philipp Dreher
8200fdb6c2 moved files for flyingship to subdir "spells" 2015-11-02 15:40:26 +01:00
Enno Rehling
f70b385bef clean up plan_monsters and make it a bit more readable 2015-11-02 15:27:01 +01:00
Enno Rehling
072bfd3912 testin building_is_active
testing multiple units in one building
2015-11-02 15:06:30 +01:00
Enno Rehling
4bf2509fb3 test inside_building vs. overflow
fix default building capacity (should be 1 per size)
2015-11-02 14:56:58 +01:00
Enno Rehling
42ae086def unit is inisde a building also when it was not paid for 2015-11-02 14:49:48 +01:00
Enno Rehling
24ff4c301d refactor: separate building_is_active from inside_building 2015-11-02 14:18:50 +01:00
Philipp Dreher
098abcc144 internal restructuring in flyingship 2015-11-02 14:01:38 +01:00
Philipp Dreher
abd6be475f that just slipped in the commit by accident... 2015-11-02 13:55:28 +01:00
Philipp Dreher
fe0d038bf3 moved more related functionality from shipcurse.c to flyingship.c 2015-11-02 13:39:06 +01:00
Philipp Dreher
2fe95f3d61 integration of the separate if-conditions and simplification of the loop 2015-11-02 13:12:19 +01:00
Philipp Dreher
bf779fc810 removed obsolete code 2015-11-02 13:06:14 +01:00
Philipp Dreher
d93305b180 moved flying ship functionality from move.c to flyingship.c 2015-11-02 00:35:32 +01:00
Philipp Dreher
6e7510b7e9 moved flying ship functionality from spells.c and shipcurse.c to flyingship.c 2015-11-02 00:32:56 +01:00
Philipp Dreher
3fa4c18e87 added files for new module "flyingship" 2015-11-02 00:26:23 +01:00
Philipp Dreher
b107ddadf5 added assert to check the faction-pointer 2015-11-01 21:43:18 +01:00
Philipp Dreher
491e5faed9 Revert "general check for sf->faction's validity"
This reverts commit f18b5ea7d2.
2015-11-01 21:40:06 +01:00
Philipp Dreher
f18b5ea7d2 general check for sf->faction's validity
The handling of an ally without a valid faction-pointer is now skipped
in favor of a logged error.
2015-11-01 18:54:29 +01:00
Philipp Dreher
91155f509c formatting: tabs --> spaces 2015-11-01 17:38:12 +01:00
Philipp Dreher
dab8bdf7ef WIP new test for armor penetration 2015-11-01 17:15:11 +01:00
Philipp Dreher
b6443e40ba reanimated dead code 2015-11-01 17:14:51 +01:00
Enno Rehling
0b098dede6 remove invalid tests. uninitialized locales do not have default words 2015-11-01 05:35:10 +01:00
Philipp Dreher
bebc92f82d expansion of the skillpotion-test
test now checks the effect of the potion on the week-counter of
sufficiently high skills
2015-10-31 19:03:15 +01:00
Enno Rehling
fbf483fb4e CID 22518: Parse warning (PW.PARAM_SET_BUT_NOT_USED) 2015-10-30 15:21:06 +01:00
Enno Rehling
21a2313e2a CID 22517: Parse warning (PW.PARAM_SET_BUT_NOT_USED) 2015-10-30 15:20:06 +01:00
Enno Rehling
a91a0f6a53 CID 22514: Out-of-bounds read (OVERRUN) 2015-10-30 15:17:39 +01:00
Enno Rehling
0da10ea490 CID 22513: Out-of-bounds read (OVERRUN) 2015-10-30 14:41:52 +01:00
Enno Rehling
674bc2b4c7 nope, the ticket is actually required. 2015-10-30 12:58:27 +01:00
Enno Rehling
e7ca5345d7 CID 22509: Dereference null return value (NULL_RETURNS)
potential problems at the edge of the map.
2015-10-30 12:57:07 +01:00
Enno Rehling
8f7f182c91 CID 22507: Dereference null return value (NULL_RETURNS)
checking fopen results
2015-10-30 12:55:30 +01:00
Enno Rehling
d6bc1c3119 CID 22506: Dereference null return value (NULL_RETURNS)
always check fopen success
2015-10-30 12:54:07 +01:00
Enno Rehling
204b4d6b93 CID 22505: Dereference null return value (NULL_RETURNS)
potential bugs at the edge of the map
2015-10-30 12:52:18 +01:00
Enno Rehling
1df0afc58a CID 22550: Dereference before null check (REVERSE_INULL) 2015-10-30 12:50:32 +01:00
Enno Rehling
1d204b12f1 CID 22549: Dereference before null check (REVERSE_INULL) 2015-10-30 12:49:37 +01:00
Enno Rehling
e1eb5098d4 CID 22554: Improper use of negative value (REVERSE_NEGATIVE)
I believe this was a false positive, but more asserts can never hurt.
2015-10-30 12:40:48 +01:00
Enno Rehling
93b7bacff5 CID 22552: Dereference before null check (REVERSE_INULL) 2015-10-30 12:37:27 +01:00
Enno Rehling
54304af182 allocate space for null terminator 2015-10-30 12:08:09 +01:00
Enno Rehling
7fa12ae3af CID 22556: String not null terminated (STRING_NULL)
add missing null-termination
2015-10-30 11:59:05 +01:00
Enno Rehling
68f8f0830e CID 22561: Copy into fixed size buffer (STRING_OVERFLOW) 2015-10-30 11:45:20 +01:00
Enno Rehling
be0563c1f0 CID 22560: Copy into fixed size buffer (STRING_OVERFLOW) 2015-10-30 11:43:45 +01:00
Enno Rehling
5d273e475e CID 22558: Copy into fixed size buffer (STRING_OVERFLOW)
bsdstring buffer size check
2015-10-30 11:41:59 +01:00
Enno Rehling
1fb04179dc CID 22557: Copy into fixed size buffer (STRING_OVERFLOW)
eliminate code duplication. bsdstring is better than libc strings.
2015-10-30 11:39:47 +01:00
Enno Rehling
ca7d25858e CID 22563: Copy into fixed size buffer (STRING_OVERFLOW)
bsdstring to the rescue, once again
2015-10-30 11:16:09 +01:00
Enno Rehling
0de6e5ecb8 CID 22564: Copy into fixed size buffer (STRING_OVERFLOW)
buffer sizes => bsdstring.h
2015-10-30 11:13:48 +01:00
Enno Rehling
df82a9795d CID 22565: Copy into fixed size buffer (STRING_OVERFLOW)
bsdstring to the rescue
2015-10-30 11:11:54 +01:00
Enno Rehling
b8d7fa5bcc CID 22567: Copy into fixed size buffer (STRING_OVERFLOW)
bsdstring replacements, again
2015-10-30 11:09:28 +01:00
Enno Rehling
51f66b8da8 CID 22568: Copy into fixed size buffer (STRING_OVERFLOW)
more bsdstring replacements
2015-10-30 11:06:24 +01:00
Enno Rehling
e69635d697 CID 22569: Copy into fixed size buffer (STRING_OVERFLOW)
bsdstring functions are the best.
2015-10-30 11:02:51 +01:00
Enno Rehling
4ee0f76927 CID 22570: Copy into fixed size buffer (STRING_OVERFLOW)
not only that, but strlcpy is the faster option here, too.
2015-10-30 10:57:52 +01:00
Enno Rehling
2f82cccea1 CID 22571: Copy into fixed size buffer (STRING_OVERFLOW)
replace strcat with strlcat
2015-10-30 10:55:06 +01:00
Enno Rehling
05ef6deb26 CID 22572: Copy into fixed size buffer (STRING_OVERFLOW) 2015-10-29 20:47:07 +01:00
Enno Rehling
4e431b41e2 CID 22575 (#2-1 of 2): Copy into fixed size buffer (STRING_OVERFLOW) 2015-10-29 20:45:36 +01:00
Enno Rehling
d3f7bd7b10 CID 22597: va_start/va_end mismatch 2015-10-29 20:43:37 +01:00
Enno Rehling
4eb6a89821 CID 26262: short and unsigned types are the devil, use int everywhere for fewer headaches 2015-10-29 20:39:44 +01:00
Enno Rehling
b3edd8dc5a anerror in this bugfix was found by a lua test. sweet! 2015-10-29 18:55:47 +01:00
Enno Rehling
3bf5ba14bb CID 26252: Memory - illegal accesses (BUFFER_SIZE_WARNING)
Calling strncpy with a maximum size argument of 5 bytes on destination array "code" of size 5 bytes might leave the destination string unterminated.
2015-10-29 16:51:39 +01:00
Enno Rehling
1a252bc994 CID 26253: Control flow issues (DEADCODE)
transformations gone wrong in previous commit
2015-10-29 16:50:55 +01:00
Enno Rehling
6113bc2144 CID 26254: Incorrect expression (DIVIDE_BY_ZERO)
magic should never be zero, but coverity doesn't know that.
2015-10-29 16:46:43 +01:00
Enno Rehling
7a01b58e8d CID 26255: Null pointer dereferences (FORWARD_NULL) 2015-10-29 16:43:09 +01:00
Enno Rehling
0a67d53264 CID 26256: (NULL_RETURNS) 2015-10-29 16:41:53 +01:00
Enno Rehling
833a1e70be CID 26257: Null pointer dereferences (NULL_RETURNS)
this test should never fire, but it shuts up coverity
2015-10-29 16:40:18 +01:00
Enno Rehling
9d9994811a CID 26258: (NULL_RETURNS)
deal with bad connection data, static analysis doen't knwo that we never have that.
2015-10-29 16:38:29 +01:00
Enno Rehling
b7dce8071c CID 26259: Memory - corruptions
I apparently don't know how strncat works.
2015-10-29 16:36:20 +01:00
Enno Rehling
59069ae342 CID 26260: Resource leaks (RESOURCE_LEAK) 2015-10-29 16:28:59 +01:00
Enno Rehling
db6e9444d6 CID 26263: Memory - illegal accesses (UNINIT) 2015-10-29 16:27:10 +01:00
Enno Rehling
5f4c31af1c bad variable reuse leads to gcc confusion 2015-10-29 12:04:52 +01:00
Enno Rehling
8b6da79984 64 bit compatibility, thank you gcc. 2015-10-29 11:32:04 +01:00
Enno Rehling
4f25831407 coverity scan CID 22576: arguments in wrong order
I believe that was a false positive, and will try to aquelch it by naming the arguments better.
2015-10-29 11:24:01 +01:00
Enno Rehling
4384183ab8 coverity scan CID 22504: argument cannot be negative
handle error cases for ftell, just because they could happen, I guess?
2015-10-29 11:20:09 +01:00
Enno Rehling
976b6aaea1 coverity CID 22593: write to pointer after free
github issue #324
use free_land where we need it.
2015-10-29 11:17:31 +01:00
Enno Rehling
c298b7fd74 coverity CID 22501 imroper use of negative value
explicitly use SK_MAGIC instead of a lookup. Faster, easier to reason about.
2015-10-29 11:06:25 +01:00
Enno Rehling
8675002e68 coverity scan CIDs 22540 22541 22546: resource leak
the calendar should only ever be initialized once, but based on static analysis, I agree that this was sloppy.
2015-10-29 09:56:53 +01:00
Enno Rehling
2372d3aacd coverity scan CID 22516: out-of-bounds write
potentially a bug with bad XML files? only matters if we have those, but we shouldn't
2015-10-29 09:49:26 +01:00
Enno Rehling
8b92003fff coverity scan CID 22487: dereference after null check
we don't use many differnt calendars, so this has never happened.
2015-10-29 09:43:51 +01:00
Enno Rehling
e27c4b4164 coverity scan CID 22457: logically dead code
the original TEACH_FRIENDS feature could not possibly have worked?
2015-10-29 09:39:33 +01:00
Enno Rehling
f4c32acd05 coverity scan CID 22515: out-of-bounds access
increase buffer to stop coverity false positive
2015-10-29 09:32:31 +01:00
Enno Rehling
55b3bfd90e coverity scan CID 22574: copy into fixed size buffer
zOrder *should* probably be big enough, but static analysis says safe is safe.
2015-10-29 09:28:02 +01:00
Enno Rehling
6ebfd33478 coverity scan CID 22503: negative array index write 2015-10-29 09:24:58 +01:00
Enno Rehling
c7aa8c89b1 coverity scan CID 22551: dereference before null check 2015-10-29 09:22:00 +01:00
Enno Rehling
4da658584c coverity scan CID 22511: dereference null return value 2015-10-29 09:20:58 +01:00
Enno Rehling
178a740ecf coverity scan CID 22573: copy into fixed-size buffer
in theory, all IDs in the game should be no longer than 4 characters, but coverity doesn't know this.
2015-10-29 09:17:23 +01:00
Enno Rehling
78899ca801 coverity scan CID 22433: buffer not null terminated, prefer strlcpy over strncpy 2015-10-29 09:06:53 +01:00
Enno Rehling
04bf07a526 coverity scan (multiple CID) is confuced about a_remove, trying to help it. 2015-10-29 09:06:52 +01:00
Enno Rehling
65429a12c3 coverity scan CID 22585, 22586: result is not floating point 2015-10-29 09:06:51 +01:00
Enno Rehling
70d4a6af03 coverity scan CID 22553: dereference before null check 2015-10-29 09:06:50 +01:00
Enno Rehling
e60b739ea4 coverity scan CID 22448: logically dead code 2015-10-29 09:06:48 +01:00
Enno Rehling
f72314e915 coverity scan CID 22451 (logically dead code) 2015-10-29 09:06:47 +01:00
Enno Rehling
6cccdec4a2 coverity scan CID 22454 (logically dead code) 2015-10-29 09:06:46 +01:00
Enno Rehling
0328e84c6c coverity scan CID 22555: sizeof not portable
wrong type in sizeof (pointer instead of struct)
2015-10-29 09:06:43 +01:00
Enno Rehling
185a2ee29c Merge pull request #321 from ennorehling/feature/fixme-base36-static
eliminate static variable leak and allocation from base36
2015-10-27 13:30:12 +01:00
Enno Rehling
f80f37def3 eliminate static variable leak and allocation from base36 2015-10-27 12:48:34 +01:00
Enno Rehling
feb915fe4a eliminate deprecated reporting function, static variable 2015-10-27 12:40:04 +01:00
Enno Rehling
e3572ef14e eliminate deprecated call 2015-10-27 12:40:04 +01:00
Enno Rehling
e23a7fc87d deprecate report_kampfstatus and implement a replacement function. 2015-10-27 12:40:04 +01:00
Enno Rehling
f2b0ba1ec6 eliminate find_spell warning for games where nobody is cursed, and you cannot summon igjarjuk 2015-10-27 12:40:03 +01:00
Enno Rehling
b771ec9aab test-only leak: do some json surgery and delete the entire tree from the export 2015-10-15 09:06:44 +02:00
Enno Rehling
47e925473e always use a macro, not magical constants 2015-10-15 08:40:52 +02:00
Enno Rehling
c9e7a76d9b minor leak: release memory held by curse_type structures 2015-10-15 08:38:43 +02:00
Enno Rehling
d4655ee88a leak: do not create new message_type objects in test_cleanup 2015-10-15 08:29:20 +02:00
Enno Rehling
d79745812a unit needs to be in a region or test_cleanup will not free it 2015-10-14 22:19:15 +02:00
Enno Rehling
467ce2a719 visual studio compilation fix 2015-10-14 22:09:11 +02:00
Enno Rehling
ef1a2dfc4f fixed a crash 2015-10-14 22:06:40 +02:00
Enno Rehling
3200dd2dc8 leak: free locale_data 2015-10-14 21:51:43 +02:00
Enno Rehling
b5455531e7 do not leak terrain.herbs 2015-10-14 21:37:27 +02:00
Enno Rehling
c04bda102b call free_order for each remaining reference 2015-10-14 20:56:09 +02:00