Changeset a4cf312 in mainline


Ignore:
Timestamp:
2019-06-05T13:58:08Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
58168e0
Parents:
a18da67
Message:

Fix build with -fsanitize=undefined

Location:
uspace/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/ubsan.c

    ra18da67 ra4cf312  
    3535};
    3636
     37struct type_mismatch_data_v1 {
     38        struct source_location loc;
     39        struct type_descriptor *type;
     40        unsigned char log_alignment;
     41        unsigned char type_check_kind;
     42};
     43
    3744struct overflow_data {
    3845        struct source_location loc;
     
    7380        struct source_location loc;
    7481        struct source_location attr_loc;
     82};
     83
     84struct pointer_overflow_data {
     85        struct source_location loc;
    7586};
    7687
     
    8192 */
    8293void __ubsan_handle_type_mismatch(struct type_mismatch_data *data, unsigned long ptr);
     94void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data, unsigned long ptr);
    8395void __ubsan_handle_add_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs);
    8496void __ubsan_handle_sub_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs);
     
    99111void __ubsan_handle_nonnull_return(struct nonnull_return_data *data);
    100112void __ubsan_handle_builtin_unreachable(struct unreachable_data *data);
     113void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data,
     114    unsigned long base, unsigned long result);
    101115
    102116static void print_loc(const char *func, struct source_location *loc)
     
    121135}
    122136
     137void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data,
     138    unsigned long ptr)
     139{
     140        print_loc(__func__, &data->loc);
     141        PRINTF("Type: %s, alignment: %hhu, type_check_kind: %hhu\n",
     142            data->type->type_name, data->log_alignment, data->type_check_kind);
     143        ubsan_panic();
     144}
     145
    123146void __ubsan_handle_add_overflow(struct overflow_data *data,
    124147    unsigned long lhs,
     
    228251        ubsan_panic();
    229252}
     253
     254void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data,
     255    unsigned long base, unsigned long result)
     256{
     257        print_loc(__func__, &data->loc);
     258        ubsan_panic();
     259}
  • uspace/lib/crypto/crypto.c

    ra18da67 ra4cf312  
    3232 */
    3333
     34#include <assert.h>
    3435#include <str.h>
    3536#include <macros.h>
    3637#include <errno.h>
    3738#include <byteorder.h>
     39#include <limits.h>
    3840#include "crypto.h"
    3941
     
    197199    hash_func_t hash_sel)
    198200{
     201        assert(input_size < SSIZE_MAX);
     202
    199203        if (!input)
    200204                return EINVAL;
Note: See TracChangeset for help on using the changeset viewer.