double Ariphmetic::plus(double a, double b) { bool positive_a = (a > 0) ? true : false; bool positive_b = (b > 0) ? true : false; if (!(positive_a ^ positive_b)) { double limit = std::numeric_limits<double>::max(); double _a = (positive_a) ? a : -a; double _b = (positive_b) ? b : -b; if (_a > limit - _b) throw overflow(); } return a + b; }
/*! \overload Displays the number \a num. */ void QLCDNumber::display(int num) { Q_D(QLCDNumber); d->val = (double)num; bool of; QString s = int2string(num, d->base, d->ndigits, &of); if (of) emit overflow(); else d->internalSetString(s); }
main(int argc, char **argv) { int c; char ip[16], user[32], pass[32], rep[512]; ip[0] = 0; user[0] = 0; pass[0] = 0; rep[0] = 0; if (argc < 2) { usage(argv[0]); exit(0); } while ((c = getopt(argc, argv, "h::l:p:i:r:")) != -1) { switch(c) { case 'h': usage(argv[0]); exit(0); case 'i': strncpy(ip, optarg, sizeof(ip)); break; case 'l': strncpy(user, optarg, sizeof(user)); break; case 'p': strncpy(pass, optarg, sizeof(pass)); break; case 'r': strncpy(rep, optarg, sizeof(rep)); break; } } if(ip) { printf("Connecting to vulnerable CVS server ..."); xp_connect(ip); printf("OK\n"); } printf("Logging in ..."); login(user, pass, rep); printf("OK\n"); printf("Exploiting the CVS error_prog_name double free now ..."); overflow(); printf("DONE\n"); printf("If everything went well there should be a shell on port 30464\n"); }
String CSSContentDistributionValue::customCSSText() const { CSSValueList* list = CSSValueList::createSpaceSeparated(); if (m_distribution != CSSValueInvalid) list->append(*distribution()); if (m_position != CSSValueInvalid) list->append(*position()); if (m_overflow != CSSValueInvalid) list->append(*overflow()); return list->customCSSText(); }
/// Equivalent to a vsprintf on the string. int ostringstream::vformat (const char* fmt, va_list args) { size_t rv, space; do { space = remaining(); rv = vsnprintf (const_cast<char *>(ipos()), space, fmt, args); if (ssize_t(rv) < 0) rv = space; } while (rv >= space && rv < overflow(rv + 1)); SetPos (pos() + minV (rv, space)); return (int)(rv); }
/* * Write current event to the event log * @this_fn -- function address * @call_site -- where it was called from * @type -- entry or exit */ static void __noprof log_event(void *this_fn, void *call_site, u8 type) { if (!overflow()) { events[top].type = type; events[top].time = NOW(); events[top].function = this_fn; events[top++].call_site = call_site; if (top == PROFBUF_MAX) mode = PROFILER_NEEDFLUSH; } else mode = PROFILER_NEEDFLUSH; }
void __test_static_string_size() { my_static_string_t a("a"); my_static_string_t empty(""); my_static_string_t full("aaaaaaaaaaa"); my_static_string_t overflow("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); UF_TEST_EQUAL(a.size(), 1); UF_TEST_EQUAL(empty.size(), 0); UF_TEST_EQUAL(full.size(), 11); UF_TEST_EQUAL(overflow.size(), my_static_string_t::capacity); }
virtual int sync() { // first, call overflow to clear in_buff overflow(); if (! pptr()) return -1; // then, call deflate asking to finish the zlib stream zstrm_p->next_in = nullptr; zstrm_p->avail_in = 0; if (deflate_loop(Z_FINISH) != 0) return -1; deflateReset(zstrm_p); return 0; }
void Histogram<T>::print () const { std::cout << "Total: " << size() << ", " << "Min: " << _min << ", " << "Max: " << _max << '\n'; std::cout << std::left << std::setw(6) << "-1" << '(' << std::setw(5) << lowest() << "-) " << std::right << std::setw(6) << underflow() << '\n'; for (unsigned i=0; i<_bins; ++i) { std::cout << std::left << std::setw(6) << i << '(' << std::setw(5) << low(i) << ", " << std::setw(5) << high(i) << ")" << std::right << std::setw(6) << _bin[i] << '\n'; } std::cout << std::left << std::setw(6) << _bins << '(' << std::setw(5) << highest() << "+) " << std::right << std::setw(6) << overflow() << '\n'; }
void adc(CPU *cpu, unsigned char* memory) { uint16_t imm = fetch_data(cpu,memory); uint16_t temp = imm + cpu->A + cpu->P[0]; cpu->P[1] = ((temp & 0xFF) == 0) ? 1 : 0; cpu->P[7] = (temp & 0x80) ? 1 : 0; cpu->P[6] = overflow(cpu->A, (uint8_t)(imm), (uint8_t)(temp)); cpu->P[0] = (temp & 0x100) ? 1 : 0; cpu->A = (uint8_t)(temp & 0x0FF); cpu->PC += address_bytes[memory[cpu->PC]] + 1; cpu->cycles += 2; }
static void push_level(name_pointer p) #line 340 "ctangle.w" { if(stack_ptr==stack_end)overflow("stack"); *stack_ptr= cur_state; stack_ptr++; if(p!=NULL){ cur_name= p;cur_repl= (text_pointer)p->equiv; cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start; cur_section= 0; } }
int Mystreambuf::sync (void) { if (!unbuffered()) { overflow (); // Force output char * gp = base(); setp (gp, gp + blen() / 2); gp = base() + blen() / 2; setg (0, 0, 0); } return 0; }
String CSSContentDistributionValue::customCSSText() const { RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); if (m_distribution != CSSValueInvalid) list->append(distribution()); if (m_position != CSSValueInvalid) list->append(position()); if (m_overflow != CSSValueInvalid) list->append(overflow()); return list.release()->customCSSText(); }
void #line 211 "./cwebdir/ctang-w2c.ch" push_level P1C(name_pointer,p) #line 340 "./cwebdir/ctangle.w" { if(stack_ptr==stack_end)overflow("stack"); *stack_ptr= cur_state; stack_ptr++; if(p!=NULL){ cur_name= p;cur_repl= (text_pointer)p->equiv; cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start; cur_section= 0; } }
void iq_opt_insert_doread(iq_t iq, seqno_t i, iq_item_t msg) { item_t *item ; seqno_t next ; assert(iq_opt_insert_check(iq, i)) ; assert (i >= iq->lo) ; next = i + 1 ; iq->read = next ; iq->hi = next ; if (i >= maxi(iq)) { overflow(iq, i) ; } item = get_unsafe(iq, i) ; do_set(item, msg) ; }
void push_nest () { if (nest_ptr > max_nest_stack) { max_nest_stack = nest_ptr; if (nest_ptr == nest_end && !realloc_nest()) { overflow("semantic nest size", nlists); } } *nest_ptr++ = cur_list; tail = head = new_avail(); prev_graf = 0; mode_line = line; }
int main(){ char big_fucker[128]; int i; //Overwrite SFP, ret, and *str for(i = 0; i < 128; i++){ big_fucker[i] = 'A'; } //EIP?! -- unknown //Stack is f****d; all heap freed, though overflow(big_fucker); exit(0); }
/* virtual */ void nsBCTableCellFrame::GetSelfOverflow(nsRect& aOverflowArea) { nsMargin halfBorder; float p2t = GetPresContext()->PixelsToTwips(); halfBorder.top = BC_BORDER_TOP_HALF_COORD(p2t, mTopBorder); halfBorder.right = BC_BORDER_RIGHT_HALF_COORD(p2t, mRightBorder); halfBorder.bottom = BC_BORDER_BOTTOM_HALF_COORD(p2t, mBottomBorder); halfBorder.left = BC_BORDER_LEFT_HALF_COORD(p2t, mLeftBorder); nsRect overflow(nsPoint(0,0), GetSize()); overflow.Inflate(halfBorder); aOverflowArea = overflow; }
bigInt bigInt::add(bigInt b, bool &carry) { bigInt c; carry = 0; for (int i=0; i < size; i++) { c.a[i] = a[i] + b.a[i] + carry; if(overflow(a[i],b.a[i],carry)) carry=1; else carry=0; } return c; }
BTree* bt_insert (BTree* a, int x) { insert(a,x); if(overflow(a)) { int m; BTree* b = split(a,&m); BTree* r = bt_create(a->ordem); r->k[0] = m; r->p[0] = a; r->p[1] = b; r->n = 1; return r; } return a; }
bool tex::realloc_nest () { list *tmp; nlists += NEST_INC; tmp = (list *)realloc(nest, nlists * sizeof(list)); if (tmp == (list *) 0) { overflow("nest", nlists); } nest = tmp; nest_end = nest + nlists - 1; nest_ptr = nest + nlists - NEST_INC; return TRUE; }
// Parse an identifier from the input stream void parseid(void) { char c = *idbuf = tolower(inchar); byte idbuflen = 1; fetchc(); while (isalnum(inchar) || (inchar == '.') || (inchar == '_')) { if (idbuflen >= IDLEN) overflow(M_id); idbuf[idbuflen++] = tolower(inchar); fetchc(); } idbuf[idbuflen] = 0; // do we have a one-char alpha nvar identifier? if ((idbuflen == 1) && isalpha(c)) { sym = s_nvar; symval = c - 'a'; } // a pin identifier 'a'digit* or 'd'digit*? else if ((idbuflen <= 3) && ((c == 'a') || (c == 'd')) && isdigit(idbuf[1]) && ( #if !defined(TINY85) isdigit(idbuf[2]) || #endif (idbuf[2] == 0))) { sym = (c == 'a') ? s_apin : s_dpin; symval = pinnum(idbuf); } // reserved word? else if (findindex(idbuf, (const prog_char *) reservedwords, 1)) { sym = pgm_read_byte(reservedwordtypes + symval); // e.g., s_if or s_while } // function? else if (findindex(idbuf, (const prog_char *) functiondict, 1)) sym = s_nfunct; #ifdef LONG_ALIASES else if (findindex(idbuf, (const prog_char *) aliasdict, 0)) sym = s_nfunct; #endif #ifdef PIN_ALIASES else if (findpinname(idbuf)) {;} // sym and symval are set in findpinname #endif #ifdef USER_FUNCTIONS else if (find_user_function(idbuf)) sym = s_nfunct; #endif else findscript(idbuf); }
void quoted(char **s, char **to, char *end) /* handle escaped sequence */ { char *p = *s; char *t = *to; wchar_t c; switch(c = *p++) { case 't': c = '\t'; break; case 'n': c = '\n'; break; case 'f': c = '\f'; break; case 'r': c = '\r'; break; case 'b': c = '\b'; break; default: if (t < end-1) /* all else must be escaped */ *t++ = '\\'; if (c == 'x') { /* hexadecimal goo follows */ c = hexstr(&p); if (t < end-MB_CUR_MAX) t += wctomb(t, c); else overflow(); *to = t; *s = p; return; } else if (isoctdigit(c)) { /* \d \dd \ddd */ c -= '0'; if (isoctdigit(*p)) { c = 8 * c + *p++ - '0'; if (isoctdigit(*p)) c = 8 * c + *p++ - '0'; } } break; } if (t < end-1) *t++ = c; *s = p; *to = t; }
/* sec 0273 */ void check_full_save_stack(void) { if (save_ptr > max_save_stack) { max_save_stack = save_ptr; #ifdef ALLOCATESAVESTACK if (max_save_stack > current_save_size - 6) save_stack = realloc_save_stack(increment_save_size); if (max_save_stack > current_save_size - 6) { overflow("save size", current_save_size); return; } #else if (max_save_stack > save_size - 6) { overflow("save size", save_size); return; } #endif } }
int streambuf::sputc(char c) { #if 0 if (openedFor & ios_base::app) { seekoff(0, ios_base::end, ios_base::out); } if (mpnext < mpend) { *mpnext = c; ++mpnext; } else { return overflow(traits::to_int(c)); } return traits::to_int(c); #else return overflow(traits::to_int(c)); #endif }
void Game::checkBallsPaddleCollision() { for(auto it = balls.begin(); it != balls.end(); ++it) { Ball *ball = (*it); std::vector<float> overflow(2, 0); if(CollisionManager::collideRectPlus((*it)->getBounds(), player->getBounds(), overflow)) { if(overflow[0] != 0 || overflow[1] != 0) { SoundManager::get("paddle_bounce")->play(); ball->increaseSpeed(Config::getFloat("paddle_bnc_speed_inc", 0.01f)); ball->setY(player->getY() - ball->getHeight()); (*it)->setDirectionY((*it)->getDirectionY()*-1); (*it)->setDirectionX(((((*it)->getX() + (*it)->getWidth()*.5f) - (player->getX() + player->getWidth()*.5f))/player->getWidth()*.5f) * Config::getFloat("paddle_bnc_wide", 3.0f)); } } } }
static void insert (BTree* a, int x) { int pos; findpos(a,x,&pos); /* insere mesmo se ja existir */ if (isleaf(a)) { addright(a,pos,x,NULL); } else { insert( a->p[pos], x ); if (overflow(a->p[pos])) { int m; BTree* b = split(a->p[pos],&m); addright(a,pos,m,b); } } }
int basic_zip_streambuf<charT, traits>::sync(void) { if(this->pptr() && this->pptr() > this->pbase()) { /*int c =*/ overflow(EOF); // ACHTUNG wenn das drin ist hoert er nach dem ersten endl auf! /* if ( c == EOF) return -1; */ } return 0; }
streamfilter::int_type streamfilter::sync() { ASSERT(m_buf); // Flush our buffers int_type ofrval = overflow(EOF); // Flush the next buffer in the chain int_type psynrval = m_buf->pubsync(); // Report any errors if (ofrval == EOF || psynrval == EOF) { return EOF; } return psynrval; }
/* public slots */ void LogDock::appendMsgToLog(QString &msg) { Log->append(msg); Log->setToolTip( QString("Event/Error Log\nMaxSize:\t%1 Bytes\nCurrent:\t%2") .arg(currLogSize * ONE_MB) .arg(Log->toPlainText().count())); if ( Log->toPlainText().count()>currLogSize * ONE_MB ) { if ( autoSaveLog->isChecked() ) { saveLogToFile(); } else { emit overflow(true); }; }; }