Coverage Report

Created: 2025-12-20 07:02

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/nss/fuzz/targets/lib/tls/socket.cc
Line
Count
Source
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
#include "socket.h"
6
7
#include <algorithm>
8
#include <cassert>
9
#include <cstdint>
10
#include <cstring>
11
12
#include "prinrval.h"
13
#include "prio.h"
14
15
namespace TlsSocket {
16
17
2.80M
int32_t DummyPrSocket::Read(PRFileDesc *fd, void *data, int32_t len) {
18
2.80M
  assert(data && len > 0);
19
20
2.80M
  int32_t amount = std::min(len, static_cast<int32_t>(len_));
21
2.80M
  memcpy(data, buf_, amount);
22
23
2.80M
  buf_ += amount;
24
2.80M
  len_ -= amount;
25
26
2.80M
  return amount;
27
2.80M
}
28
29
546k
int32_t DummyPrSocket::Write(PRFileDesc *fd, const void *buf, int32_t length) {
30
546k
  return length;
31
546k
}
32
33
int32_t DummyPrSocket::Recv(PRFileDesc *fd, void *buf, int32_t buflen,
34
2.80M
                            int32_t flags, PRIntervalTime to) {
35
2.80M
  assert(flags == 0);
36
2.80M
  return Read(fd, buf, buflen);
37
2.80M
}
38
39
}  // namespace TlsSocket