ad_parser.c (e501bae08349e058caa4648e0af3dd01cbd89d20) ad_parser.c (c1ab6cc1beb14b16b46e74a3723644016d8c3cc7)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 58 unchanged lines hidden (view full) ---

67 // assert chunk_len and chunk_type are withing buffer
68 if ((context->offset+1) >= context->length) return 0;
69
70 // assert chunk_len > 0
71 int chunk_len = context->data[context->offset];
72 if (chunk_len == 0) return 0;
73
74 // assert complete chunk fits into buffer
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 58 unchanged lines hidden (view full) ---

67 // assert chunk_len and chunk_type are withing buffer
68 if ((context->offset+1) >= context->length) return 0;
69
70 // assert chunk_len > 0
71 int chunk_len = context->data[context->offset];
72 if (chunk_len == 0) return 0;
73
74 // assert complete chunk fits into buffer
75 if (context->offset + 1 + chunk_len > context->length) return 0;
75 if ((context->offset + 1 + chunk_len) > context->length) return 0;
76
77 return 1;
78}
79
80// pre: ad_iterator_has_more() == 1
81void ad_iterator_next(ad_context_t * context){
82 int chunk_len = context->data[context->offset];
83 context->offset += 1 + chunk_len;

--- 86 unchanged lines hidden ---
76
77 return 1;
78}
79
80// pre: ad_iterator_has_more() == 1
81void ad_iterator_next(ad_context_t * context){
82 int chunk_len = context->data[context->offset];
83 context->offset += 1 + chunk_len;

--- 86 unchanged lines hidden ---